All Products
Search
Document Center

Key Management Service:Sign

Last Updated:Mar 31, 2026

Signs data using an asymmetric key.

Usage notes

  • The request body (after Protocol Buffers encoding) cannot exceed 3 MB. Requests exceeding this limit are rejected with HTTP 413.

  • For large messages, generate a digest locally and pass it with MessageType set to DIGEST, rather than sending the raw message.

  • For supported key specifications and algorithm compatibility, see Key types and specifications.

Request parameters

ParameterTypeRequiredExampleDescription
KeyIdstringYes1234abcd-12ab-34cd-56ef-12345678****The globally unique ID of the key. You can also pass an alias bound to the key.
AlgorithmstringYesRSAES_OAEP_SHA_256The signature algorithm. Valid values: RSA_PSS_SHA_256, RSA_PKCS1_SHA_256, ECDSA_SHA_256, SM2DSA.
MessageTypestringYesRAWThe type of the message to sign. Valid values: RAW (default): KMS hashes the raw data using the algorithm specified by Algorithm, then signs the digest. DIGEST: KMS skips hashing and signs the provided digest directly using a private key. The digest must be no longer than 32 bytes.
MessagebytesYesBinary dataThe message to sign. If MessageType is RAW, pass the raw data. If MessageType is DIGEST, pass the pre-computed message digest (up to 32 bytes).

Response parameters

ParameterTypeExampleDescription
SignaturebytesBinary dataThe calculated signature value.
KeyIdstring1234abcd-12ab-34cd-56ef-12345678****The globally unique ID of the key. If you passed an alias in the request, the ID of the key bound to that alias is returned.
AlgorithmstringRSAES_OAEP_SHA_256The signing algorithm used.
MessageTypestringRAWThe message type used.
RequestIdstring475f1620-b9d3-4d35-b5c6-3fbdd941423dThe request ID.

Error codes

For a list of error codes, see Service error codes.