[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-18。"],[],[],null,["# Digital signatures\n\nA *digital signature* is a cryptographic output used to verify the authenticity\nof data. A digital signature algorithm allows for two distinct operations:\n\n- a signing operation, which uses a signing key to produce a signature over raw\n data\n\n- a verification operation, where the signature can be validated by a party\n who has no knowledge of the signing key\n\nThe main purposes of a digital signature are:\n\n- verification of the integrity of the signed data\n- non-repudiation if the signer claims the signature is not authentic\n\nDigital signatures rely on asymmetric cryptography, also known as public key\ncryptography. An asymmetric key consists of a public/private key pair. The\nprivate key is used to create a signature, and the corresponding public key is\nused to verify the signature.\n\nPost-quantum cryptography (PQC) digital signature\n-------------------------------------------------\n\n|\n| **Preview**\n|\n|\n| This feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nQuantum computers have the potential to decrypt material encrypted by classical\nencryption algorithms such as the widely used RSA and ECDSA,\nwhich could make such encrypted material vulnerable.\nPost-quantum cryptographic algorithms are designed to use classical hardware\nand software to resist quantum attacks, helping to ensure the continued validity\nof digital signatures. PQC signatures are based on different mathematical\nproblems that are difficult for both classical and quantum computers to solve.\n\nNIST has published two PQC signature standards: ML-DSA ([FIPS-204](https://csrc.nist.gov/pubs/fips/204/final))\nand SLH-DSA ([FIPS-205](https://csrc.nist.gov/pubs/fips/205/final)). You can use the pure randomized variants with\nCloud KMS: `ML-DSA-65` and `SLH-DSA-SHA2-128s`, or the pre-hash\nrandomized variant `HASH-SLH-DSA-SHA2-128s-SHA256`.\nThe NIST standards define the following size values for keys and signatures\n(in bytes):\n\n| **Note:** Due to the lack of a standard for hybridization of post-quantum and classical digital signatures, only the standalone implementations are supported.\n\nExample use cases for a digital signature\n-----------------------------------------\n\nYou can validate builds using digital signatures. For example, given a binary\nthat is digitally signed by a private key, you can check its validity by using\nthe public key corresponding to the private key. If the binary's signature is\nnot valid, the binary has been tampered with and/or corrupted.\n\nAnother example is validating the subject of a certificate issued by a\nCertificate Authority (CA). A CA issues a certificate to a subject based on the\nsubject's ownership of the private key portion of a public/private key. The\ncertificate contains a digital signature created with the subject's private key.\nThe certificate also contains the subject's public key portion of the\npublic/private key. An entity that is interacting with the subject uses the\nsubject's public key, and additional certificate verification rules, to validate\nthe signature. If the signature does not correspond to the data in question, or\nif the verification rules prescribed by the certificate are violated, the\nsignature will be found invalid.\n\nDigital signing workflow\n------------------------\n\nThe following describes the flow for creating and validating a signature. The\ntwo participants in this workflow consist of the signer of data, and the data\nrecipient.\n\n1. The signer creates an asymmetric key that supports digital signing.\n\n The signer can use this key to create multiple signatures.\n2. The signer performs a private key operation over the data to create a\n digital signature.\n\n3. The signer provides the data and the digital signature to the data recipient.\n\n4. The recipient uses the public key portion of the signer's public/private key\n pair to verify the digital signature. If verification is unsuccessful, then the\n data has been altered.\n\nSigning algorithms\n------------------\n\nCloud Key Management Service supports elliptic curve (EC) and RSA algorithms for\ndigital signing. Both of these industry standard algorithms offer choices of key\nsize and digest algorithm.\n\nElliptic curve cryptography relies on one-way hash functions and point\nmultiplication to compute points on an elliptic curve, combined with the\nintractability of determining the multiplicand for a point given its origin.\nThis difficulty in determining the multiplicand is the cryptographic benefit of\nEC cryptography. The larger the size of the curve, the more difficult it is to\ncompute the multiplicand. A benefit of EC cryptography is an EC key has a\nsmaller key size compared to an RSA key that offers the same cryptographic\nstrength.\n\nRSA cryptography relies on the difficulty in factoring a large integer into two\nor more factors. The larger the key size, the more difficult it is to factor the\nintegers.\n\nCloud KMS digital signature functionality\n-----------------------------------------\n\nCloud KMS provides the following functionality related to creating\nand validating digital signatures.\n\n- Ability to [create an asymmetric key](/kms/docs/creating-asymmetric-keys) with [key purpose](/kms/docs/algorithms#key_purposes) of\n `ASYMMETRIC_SIGN`. Cloud KMS keys for asymmetric signing support\n both [elliptic curve signing algorithms](/kms/docs/algorithms#elliptic_curve_signing_algorithms) and [RSA signing algorithms](/kms/docs/algorithms#rsa_signing_algorithms).\n\n- Ability to [create a digital signature](/kms/docs/create-validate-signatures#create_signature).\n\n- Ability to [retrieve the public key](/kms/docs/retrieve-public-key) for an asymmetric key.\n\nCloud KMS does not directly provide the ability to validate a\ndigital signature. Instead, you validate a digital signature using openly\navailable SDKs and tools, such as [OpenSSL](https://www.openssl.org/). These SDKs and tools require the\npublic key that you retrieve from Cloud KMS. For information on how\nto use open SDKs and tools, see [validating an elliptic curve signature](/kms/docs/create-validate-signatures#validate_ec_signature) and\n[validating an RSA signature](/kms/docs/create-validate-signatures#validate_rsa_signature)."]]