mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-09 23:42:21 -04:00
monorepo
Co-authored-by: Malte Poll <mp@edgeless.systems> Co-authored-by: katexochen <katexochen@users.noreply.github.com> Co-authored-by: Daniel Weiße <dw@edgeless.systems> Co-authored-by: Thomas Tendyck <tt@edgeless.systems> Co-authored-by: Benedict Schlueter <bs@edgeless.systems> Co-authored-by: leongross <leon.gross@rub.de> Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com>
This commit is contained in:
commit
2d8fcd9bf4
362 changed files with 50980 additions and 0 deletions
38
coordinator/kms/clusterkms_test.go
Normal file
38
coordinator/kms/clusterkms_test.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
package kms
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestCoordinatorKMS(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
kms := &ClusterKMS{}
|
||||
masterKey := []byte("Constellation")
|
||||
|
||||
key, err := kms.GetDEK(context.Background(), "", "key-1", 32)
|
||||
assert.Error(err)
|
||||
assert.Nil(key)
|
||||
|
||||
err = kms.CreateKEK(context.Background(), "", masterKey)
|
||||
assert.NoError(err)
|
||||
assert.Equal(masterKey, kms.masterKey)
|
||||
|
||||
key1, err := kms.GetDEK(context.Background(), "", "key-1", 32)
|
||||
assert.NoError(err)
|
||||
assert.Len(key1, 32)
|
||||
|
||||
key2, err := kms.GetDEK(context.Background(), "", "key-1", 32)
|
||||
assert.NoError(err)
|
||||
assert.Equal(key1, key2)
|
||||
|
||||
key3, err := kms.GetDEK(context.Background(), "", "key-2", 32)
|
||||
assert.NoError(err)
|
||||
assert.NotEqual(key1, key3)
|
||||
|
||||
key, err = kms.GetDEK(context.Background(), "", "key", 64)
|
||||
assert.NoError(err)
|
||||
assert.Len(key, 64)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue