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 client
key is the base64 encoded key value in the kinesis record
data is the base64 encoded databaseActivityEvents value in the kinesis record
clusterResourceId 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 basically client.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
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
kmsClientis the AWS sdk v2 kms clientkeyis the base64 encodedkeyvalue in the kinesis recorddatais the base64 encodeddatabaseActivityEventsvalue in the kinesis recordclusterResourceIdis what it sounds likethis results in a decrypted struct, in which is the ARN for the key used, this is then used below
encryptionClientis basicallyclient.NewClientWithConfig(encryptionConfig)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"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