mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-06 08:15:48 -04:00
s3proxy: add keyservice integration
Encrypt each object with a random DEK and attach the encrypted DEK as object metadata. Encrpt the DEK with a key from the keyservice. All objects use the same KEK until a keyrotation takes place.
This commit is contained in:
parent
a7ceda37ea
commit
887dcda78b
15 changed files with 414 additions and 71 deletions
|
@ -46,3 +46,42 @@ func TestValidateContentMD5(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestByteSliceToByteArray(t *testing.T) {
|
||||
tests := map[string]struct {
|
||||
input []byte
|
||||
output [32]byte
|
||||
wantErr bool
|
||||
}{
|
||||
"empty input": {
|
||||
input: []byte{},
|
||||
output: [32]byte{},
|
||||
},
|
||||
"successful input": {
|
||||
input: []byte("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"),
|
||||
output: [32]byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
|
||||
},
|
||||
"input too short": {
|
||||
input: []byte("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"),
|
||||
output: [32]byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
|
||||
wantErr: true,
|
||||
},
|
||||
"input too long": {
|
||||
input: []byte("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"),
|
||||
output: [32]byte{0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41, 0x41},
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
|
||||
for name, tc := range tests {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
result, err := byteSliceToByteArray(tc.input)
|
||||
if tc.wantErr {
|
||||
assert.Error(t, err)
|
||||
return
|
||||
}
|
||||
|
||||
assert.Equal(t, tc.output, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue