MCPcopy
hub / github.com/getsops/sops / TestMasterKey_EncryptDecrypt_RoundTrip

Function TestMasterKey_EncryptDecrypt_RoundTrip

kms/keysource_test.go:352–365  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

350}
351
352func TestMasterKey_EncryptDecrypt_RoundTrip(t *testing.T) {
353 dataKey := []byte("the wheels on the bus go round and round")
354
355 encryptKey := createTestMasterKey(testKMSARN)
356 assert.NoError(t, encryptKey.Encrypt(dataKey))
357 assert.NotEmpty(t, encryptKey.EncryptedKey)
358
359 decryptKey := createTestMasterKey(testKMSARN)
360 decryptKey.EncryptedKey = encryptKey.EncryptedKey
361
362 decryptedData, err := decryptKey.Decrypt()
363 assert.NoError(t, err)
364 assert.Equal(t, dataKey, decryptedData)
365}
366
367func TestMasterKey_NeedsRotation(t *testing.T) {
368 key := NewMasterKeyFromArn(dummyARN, nil, "")

Callers

nothing calls this directly

Calls 3

createTestMasterKeyFunction · 0.85
EncryptMethod · 0.65
DecryptMethod · 0.65

Tested by

no test coverage detected