Skip to content

Add CKM_RSA_AES_KEY_WRAP - #377

Draft
Princemachiavelli wants to merge 1 commit into
parallaxsecond:mainfrom
Princemachiavelli:jhoffer/Add-CKM_RSA_AES_KEY_WRAP
Draft

Princemachiavelli wants to merge 1 commit into
parallaxsecond:mainfrom
Princemachiavelli:jhoffer/Add-CKM_RSA_AES_KEY_WRAP

Conversation

@Princemachiavelli

@Princemachiavelli Princemachiavelli commented Nov 15, 2026 •

Copy link
Copy Markdown

Adds MechanismType::RSA_AES_KEY_WRAP and Mechanism::RsaAesKeyWrap with RsaAesKeyWrapParams (CK_RSA_AES_KEY_WRAP_PARAMS). The constant and the parameter struct are already in cryptoki-sys.

CKM_RSA_AES_KEY_WRAP wraps a key under an RSA public key alone: it OAEP-wraps a fresh AES key and then uses RFC 5649 under that key, so it can wrap keys that are larger than an RSA block. We use it to move keys between tokens.

The new test, wrap_and_unwrap_key_rsa_aes, wraps and unwraps an AES key, then checks that the unwrapped key encrypts the same way. It passes on SoftHSM 2.7 and is skipped where the token does not list the mechanism (kryoptic).

Add `MechanismType::RSA_AES_KEY_WRAP` and `Mechanism::RsaAesKeyWrap` with
`RsaAesKeyWrapParams` (`CK_RSA_AES_KEY_WRAP_PARAMS`). The new wrap/unwrap test
is skipped where the token does not offer the mechanism (kryoptic).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Josh Hoffer <jhoffer@sansorgan.es>
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