Skip to content

KMS: add RSA_3072 and ECC NIST key specs with ECDSA signing - #17

Merged
damianh merged 3 commits into
mainfrom
dh/kms-rsa-3072-ecc-signing
Aug 31, 2026
Merged

KMS: add RSA_3072 and ECC NIST key specs with ECDSA signing#17
damianh merged 3 commits into
mainfrom
dh/kms-rsa-3072-ecc-signing

Conversation

@damianh

@damianh damianh commented Aug 31, 2026

Copy link
Copy Markdown
Owner

The KMS handler only supported SYMMETRIC_DEFAULT, RSA_2048, and RSA_4096, which blocked integration-testing JWT signing scenarios (RS384/PS384 and ES256/ES384/ES512) against MicroStack.

Changes

  • RSA_3072: extends the existing RSA branch; reuses the current PKCS1/PSS signing algorithm list.
  • ECC NIST keys: ECC_NIST_P256/P384/P521 create an ECDsa key alongside the existing RsaKey, exporting the public key as DER SubjectPublicKeyInfo. Each curve advertises its single matching algorithm (ECDSA_SHA_256/384/512).
  • DER signatures: ECDSA Sign/Verify use DSASignatureFormat.Rfc3279DerSequence, matching real AWS KMS (ANSI X9.62 Ecdsa-Sig-Value), not IEEE P1363 raw r||s.
  • Algorithm validation: Sign/Verify now validate the requested algorithm against the key's advertised SigningAlgorithms, returning ValidationException on mismatch (e.g. ECDSA_SHA_384 on a P-256 key) - this also tightens the previous RSA behavior.
  • Sign-only enforcement: ECC keys require KeyUsage: SIGN_VERIFY at creation and reject Encrypt/Decrypt with ValidationException.

ECC_SECG_P256K1 is left out per the issue (optional, lower priority).

Testing

  • New integration tests: RSA-3072 PKCS1/PSS SHA-384 round trips with public key import, a theory over all three NIST curves verifying metadata and independently validating DER signatures against the GetPublicKey SPKI via ECDsa.VerifyData, plus rejection tests for wrong algorithm, wrong key usage, and encrypt/decrypt on ECC keys.
  • All 40 KMS tests pass in Debug and Release; changed files pass dotnet format --verify-no-changes.

Docs page docs/services/kms updated with the new specs and DER signature semantics.

Fixes: #16

damianh and others added 3 commits August 31, 2026 14:18
Support ECC_NIST_P256/P384/P521 sign-only keys with DER-encoded
(RFC 3279) ECDSA signatures matching real AWS KMS, validate signing
algorithms against key spec, and reject Encrypt/Decrypt on ECC keys.

Fixes: #16

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Bump Aspire to 13.5.3, Amazon.Lambda packages to v3, xunit.v3 to 4.0.0,
and pinned AWSSDK.SQS/Mvc.Testing versions to clear the transitive
MessagePack vulnerability blocking CI restore.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@damianh
damianh merged commit a4939dc into main Aug 31, 2026
1 check passed
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.

KMS: add RSA_3072 and ECC NIST key specs with ECDSA signing support

1 participant