Sign

更新时间:
复制 MD 格式

Signs data using an asymmetric key.

Usage notes

After all request parameters are encoded using Protocol Buffers, the request body cannot exceed 3 MB. If the request body exceeds 3 MB, the server rejects the request and returns HTTP 413. For large messages, generate a digest locally and pass it with MessageType set to DIGEST, then call the Sign or Verify operation.

For supported key specifications and signing algorithms, see Key types and specifications.

Request parameters

ParameterTypeRequiredExampleDescription
KeyIdstringYes1234abcd-12ab-34cd-56ef-12345678****The globally unique ID of the key. You can also specify 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 message type. Valid values: RAW (default): the raw data. KMS uses the hash algorithm specified by Algorithm to generate a digest, then signs the digest. DIGEST: a pre-computed message digest. KMS uses the private key to sign the digest directly. The digest can be up to 32 bytes.
MessagebytesYesBinary dataThe message to sign.

Response elements

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

Error codes

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