Skip to content

feat(kms): Implement GetParametersForImport, ImportKeyMaterial, and DeleteImportedKeyMaterial - #10183

Open
tjhall13-nutrien wants to merge 1 commit into
getmoto:masterfrom
tjhall13-nutrien:feature/kms-import-key-material
Open

feat(kms): Implement GetParametersForImport, ImportKeyMaterial, and DeleteImportedKeyMaterial#10183
tjhall13-nutrien wants to merge 1 commit into
getmoto:masterfrom
tjhall13-nutrien:feature/kms-import-key-material

Conversation

@tjhall13-nutrien

Copy link
Copy Markdown

Implements support for importing key material into KMS keys with EXTERNAL origin.

Changes

  • CreateKey with Origin=EXTERNAL creates a key in PendingImport state (no auto-generated key material)
  • GetParametersForImport returns an RSA wrapping public key and import token
  • ImportKeyMaterial decrypts wrapped key material and activates the key
  • DeleteImportedKeyMaterial removes key material, returning key to PendingImport

Supported

  • Wrapping algorithms: RSAES_OAEP_SHA_256, RSAES_OAEP_SHA_1
  • Wrapping key specs: RSA_2048, RSA_3072, RSA_4096

Not implemented

  • RSA_AES_KEY_WRAP_SHA_256 / RSA_AES_KEY_WRAP_SHA_1 (hybrid wrapping)

Potential Breaking Changes

  • Keys created with Origin=EXTERNAL will now cause KMSInvalidStateException errors when not properly initialized with import_key_material

…eleteImportedKeyMaterial

Adds support for importing key material into KMS keys with EXTERNAL origin:

- CreateKey with Origin=EXTERNAL creates a key in PendingImport state
- GetParametersForImport returns an RSA wrapping public key and import token
- ImportKeyMaterial decrypts wrapped key material and activates the key
- DeleteImportedKeyMaterial removes key material, returning key to PendingImport
- encrypt/decrypt guard against None key_material (KMSInvalidStateException)

Supported wrapping algorithms: RSAES_OAEP_SHA_256, RSAES_OAEP_SHA_1
Supported wrapping key specs: RSA_2048, RSA_3072, RSA_4096
RSA_AES_KEY_WRAP variants are not yet implemented.

Error handling:
- UnsupportedOperationException for non-EXTERNAL keys
- KMSInvalidStateException for invalid key states or missing key material
- InvalidImportTokenException for wrong/missing import tokens
- InvalidCiphertextException for failed RSA decryption
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant