mirror of
https://github.com/cloudflare/redoctober.git
synced 2026-01-07 05:56:56 +00:00
Decrypt returns the list of users used for delegation
When decrypting a chunk of data, red october will now report the users whose keys were used in the decryption.
This commit is contained in:
22
core/core.go
22
core/core.go
@@ -8,10 +8,11 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/cloudflare/redoctober/cryptor"
|
||||
"github.com/cloudflare/redoctober/keycache"
|
||||
"github.com/cloudflare/redoctober/passvault"
|
||||
"log"
|
||||
)
|
||||
|
||||
// Each of these structures corresponds to the JSON expected on the
|
||||
@@ -60,6 +61,11 @@ type decrypt struct {
|
||||
Data []byte
|
||||
}
|
||||
|
||||
type decryptWithDelegates struct {
|
||||
Data []byte
|
||||
Delegates []string
|
||||
}
|
||||
|
||||
type modify struct {
|
||||
Name string
|
||||
Password string
|
||||
@@ -283,13 +289,23 @@ func Decrypt(jsonIn []byte) ([]byte, error) {
|
||||
return jsonStatusError(err)
|
||||
}
|
||||
|
||||
resp, err := cryptor.Decrypt(s.Data)
|
||||
data, names, err := cryptor.Decrypt(s.Data)
|
||||
if err != nil {
|
||||
log.Println("Error decrypting:", err)
|
||||
return jsonStatusError(err)
|
||||
}
|
||||
|
||||
return jsonResponse(resp)
|
||||
resp := &decryptWithDelegates{
|
||||
Data: data,
|
||||
Delegates: names,
|
||||
}
|
||||
|
||||
out, err := json.Marshal(resp)
|
||||
if err != nil {
|
||||
return jsonStatusError(err)
|
||||
}
|
||||
|
||||
return jsonResponse(out)
|
||||
}
|
||||
|
||||
// Modify processes a modify request.
|
||||
|
||||
Reference in New Issue
Block a user