(t *testing.T)
| 322 | } |
| 323 | |
| 324 | func TestMasterKey_EncryptDecrypt_RoundTrip(t *testing.T) { |
| 325 | encryptKey, err := MasterKeyFromRecipient(mockRecipient) |
| 326 | assert.NoError(t, err) |
| 327 | |
| 328 | data := []byte("some secret data") |
| 329 | assert.NoError(t, encryptKey.Encrypt(data)) |
| 330 | assert.NotEmpty(t, encryptKey.EncryptedKey) |
| 331 | |
| 332 | var ids ParsedIdentities |
| 333 | assert.NoError(t, ids.Import(mockIdentity)) |
| 334 | |
| 335 | decryptKey := &MasterKey{} |
| 336 | decryptKey.EncryptedKey = encryptKey.EncryptedKey |
| 337 | ids.ApplyToMasterKey(decryptKey) |
| 338 | |
| 339 | decryptedData, err := decryptKey.Decrypt() |
| 340 | assert.NoError(t, err) |
| 341 | assert.Equal(t, data, decryptedData) |
| 342 | } |
| 343 | |
| 344 | func TestMasterKey_NeedsRotation(t *testing.T) { |
| 345 | key := &MasterKey{Recipient: mockRecipient} |
nothing calls this directly
no test coverage detected