tencent cloud

Feedback

Asymmetric key decryption

Last updated: 2024-01-11 16:28:54

    Overview

    KMS provides the following SM2 and RSA asymmetric key-based decryption APIs:
    API Name
    Description
    Remarks
    AsymmetricSm2Decrypt
    SM2 decryption
    For more information, please see AsymmetricSm2Decrypt
    AsymmetricRsaDecrypt
    RSA decryption
    For more information, please see AsymmetricRsaDecrypt
    The samples below are called with TCCLI, and you can also use any supported programming languages.

    Asymmetric Decryption

    RSA decryption

    Input

    tccli kms AsymmetricRsaDecrypt --KeyId 22d79428-61d9-11ea-a3c8-525400****** --Algorithm RSAES_OAEP_SHA_256 --Ciphertext "DEb/JBmuhVkYS34r0pR7Gv1WTc4khkxqf7S1WIr7/GXsAs/tfP/v/2+1SwsIG7BqW7kUZqr38/FGkaIEqYeewot37t3+Jx0t5w7/yXkUnyUfyfPpXlHXf94g3wFOjijEWWsjWWzaXTkTr8uWOfRBenq+bcaY783FIy03XjJW/Y0wKWjD3tULvKndCJO/3bkb65kn1Fbsfm20xrUUwqV/p2DVLXBdG1ymr0DjsbG7R0tb3ytc2LmH33YPAQE32eP27ciKzSml+w2tdUM3dw3nEZcTGMs1wFDGk0O1WB052jZ7TitUD9zCftFv2dKlZD3LRx1+vHqpNVgPhLmL******=="

    Output

    {
    "Response": {
    "RequestId": "6758cbf5-5e21-4c37-a2cf-8d47f5******",
    "KeyId": "22d79428-61d9-11ea-a3c8-525400******",
    "Plaintext": "dGVzdAo="
    }
    }

    SM2 decryption

    Input

    tccli kms AsymmetricSm2Decrypt --KeyId 22d79428-61d9-11ea-a3c8-525400****** --Ciphertext "DEb/JBmuhVkYS34r0pR7Gv1WTc4khkxqf7S1WIr7/GXsAs/tfP/v/2+1SwsIG7BqW7kUZqr38/FGkaIEqYeewot37t3+Jx0t5w7/yXkUnyUfyfPpXlHXf94g3wFOjijEWWsjWWzaXTkTr8uWOfRBenq+bcaY783FIy03XjJW/Y0wKWjD3tULvKndCJO/3bkb65kn1Fbsfm20xrUUwqV/p2DVLXBdG1ymr0DjsbG7R0tb3ytc2LmH33YPAQE32eP27ciKzSml+w2tdUM3dw3nEZcTGMs1wFDGk0O1WB052jZ7TitUD9zCftFv2dKlZD3LRx1+vHqpNVgPhLmL******=="

    Output

    {
    "Response": {
    "RequestId": "6758cbf5-5e21-4c37-a2cf-8d47f5******",
    "KeyId": "22d79428-61d9-11ea-a3c8-525400******",
    "Plaintext": "dGVzdAo="
    }
    }

    Viewing Public Key

    Overview

    This API is used to get the information of the public key with the specified KeyId. For the API documentation, please see GetPublicKey.
    The sample below is called with TCCLI, and you can also use any supported programming languages.

    Sample

    Input

    tccli kms GetPublicKey --KeyId 22d79428-61d9-11ea-a3c8-525400******

    Output

    {
    "Response": {
    "RequestId": "408fa858-cd6d-4011-b8a0-653805******",
    "KeyId": "22d79428-61d9-11ea-a3c8-525400******",
    "PublicKey": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzQk7x7ladgVFEEGYDbeUc5aO9TfiDplIO4WovBOVpIFoDS31n46YiCGiqj67qmYslZ2KMGCd3Nt+a+jdzwFiTx3O87wdKWcF2vHL9Ja+95VuCmKYeK1uhPyqqj4t9Ch/cyvxb0xaLBzztTQ9dXCxDhwj08b24T+/FYB9a4icuqQypCvjY1X9j8ivAsPEdHZoc9Di7JXBTZdVeZC1igCVgl6mwzdHTJCRydE2976zyjC7l6QsRT6pRsMF3696N07WnaKgGv3K/Zr/6RbxebLqtmNypNERIR7jTCt9L+fgYOX7anmuF5v7z0GfFsen9Tqb1LsZuQR0vgqCauOjL2CL1Q******",
    "PublicKeyPem": "-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzQk7x7ladgVFEEGYDbeU\\nc5aO9TfiDplIO4WovBOVpIFoDS31n46YiCGiqj67qmYslZ2KMGCd3Nt+a+jdzwFi\\nTx3O87wdKWcF2vHL9Ja+95VuCmKYeK1uhPyqqj4t9Ch/cyvxb0xaLBzztTQ9dXCx\\nDhwj08b24T+/FYB9a4icuqQypCvjY1X9j8ivAsPEdHZoc9Di7JXBTZdVeZC1igCV\\ngl6mwzdHTJCRydE2976zyjC7l6QsRT6pRsMF3696N07WnaKgGv3K/Zr/6RbxebLq\\ntmNypNERIR7jTCt9L+fgYOX7anmuF5v7z0GfFsen9Tqb1LsZuQR0vgqCau******\\n1QIDAQAB\\n-----END PUBLIC KEY-----\\n"
    }
    }
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support