Skip to main content

Signing

Pass the raw message, not a digest. The service hashes it with SHA-256 server-side, so a pre-hashed input gets hashed twice and produces a signature nothing will verify.
signing_algorithm is optional; omitted, the default for the spec is used, and the algorithm actually applied comes back in the response. An algorithm that does not match the spec is rejected with 400 KMS_UNSUPPORTED_SIGNING_ALGORITHM rather than being attempted. Signatures come back in the standard encodings, so nothing downstream needs special handling: RSA-PSS uses saltLen = hashLen = 32, and ECDSA returns the ASN.1 DER (r, s) sequence of ANSI X9.62. POST /v1/keys/{key_id}/verify answers {"signature_valid": false} for a signature that simply does not match. That is a 200, not an error — an error means the request or the backend was wrong, not that the signature was.

Verification across rotations

Sign returns key_version with the signature and algorithm. Store all three. Pass that version to Verify to select the matching historical material. If you omit it, Verify tries all retained public-key versions for compatibility with older signatures. Retrieve GET /v1/keys/{key_id}/public-key?key_version=1 for offline verification. The response contains a PEM-encoded SubjectPublicKeyInfo public key and its version. Omitting key_version retrieves the current version, which may differ from the one that signed an older message. Symmetric keys have no public half. kms:Verify and kms:GetPublicKey are separate permissions; neither requires kms:Sign. See key rotation.