Closed
Description
Describe the feature
KMS not only supports symmetric and asymmetric keys but also HMAC keys: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-kms-key.html#cfn-kms-key-keyspec
It would be great to have 1st class support for them in the cdk.
Use Case
I want to implement the OAuth2 authorization_code flow with a nonce that is hmac verified and use KMS to do the signing.
Proposed Solution
Add the missing values to the KeySpec
and KeyUsage
enums:
const hmacKey = new kms.Key(this, "HMACSecret", {
enabled: true,
enableKeyRotation: true,
keySpec: kms.KeySpec.HMAC_256,
keyUsage: kms.KeyUsage.GENERATE_VERIFY_MAC,
});
Other Information
Trying to override the enum values with strings directly (like this):
const hmacKey = new kms.Key(this, "HMACSecret", {
enabled: true,
enableKeyRotation: true,
keySpec: "HMAC_256" as any,
keyUsage: "GENERATE_VERIFY_MAC" as any,
});
currently fails due to the validation here
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
CDK version used
2.60.0
Environment details (OS name and version, etc.)
MacOS, Node 18