-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Setup/structure:
Data being sent to the kinesis stream from a pgsql database whenever a field/row is updated, data is encrypted using kms.
Code:
where
kmsClient
is the AWS sdk v2 kms clientkey
is the base64 encodedkey
value in the kinesis recorddata
is the base64 encodeddatabaseActivityEvents
value in the kinesis recordclusterResourceId
is what it sounds like
decodedKey, err := base64.StdEncoding.DecodeString(key)
if err != nil {
return err
}
decodedBody, err := base64.StdEncoding.DecodeString(data)
if err != nil {
return err
}
decryptedKey, err := kmsClient.Decrypt(ctx, &kms.DecryptInput{CiphertextBlob: decodedKey, EncryptionContext: map[string]string{"aws:rds:dbc-id": clusterResourceId}})
if err != nil {
return err
}
this results in a decrypted struct, in which is the ARN for the key used, this is then used below
encryptionClient
is basicallyclient.NewClientWithConfig(encryptionConfig)
provider, err := kmsprovider.New(*decryptedKey.KeyId)
if err != nil {
return err
}
cmm, err := materials.NewDefault(provider)
if err != nil {
return err
}
d, header, err := encryptionClient.Decrypt(ctx, decodedBody, cmm)
if err != nil {
return err
}
Issue:
multiple different configurations tried, including manually providing the ARN for the key, and all of them result in the error shown below with the pertinent part being "BC" providerID doesnt match to with MasterKeyProvider ID "aws-kms"
SDK error: decryption error
decrypt materials: no data key, last error: CMM error
unable to decrypt any data key, member error: MKP error
DecryptDataKeyFromList validate expected error: MKP decrypt error
"BC" providerID doesnt match to with MasterKeyProvider ID "aws-kms"
What i would like to know is if this is potentially a bug or is there a misconfiguration on my end, if its the latter then i would appreciate a pointer in the right direction
wobondar
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working