This topic describes asymmetric keys in KMS. Unlike symmetric keys, asymmetric keys are usually used to verify digital signatures or encrypt sensitive information between systems with different trust levels.
You can create asymmetric customer master keys (CMK) in KMS. An asymmetric key pair consists of a public and a private key, which are cryptographically related to each other. The public key can be made available for anyone to use, but the private key must be kept secure and used only by trusted users. Alibaba Cloud supports popular asymmetric key algorithms and provides high levels of data security by using strong encryption and digital signatures.
Classification of asymmetric keys
RSA is a classical asymmetric crypto-system. You can use an RSA key to encrypt, decrypt, and sign data. KMS supports 2048-bit RSA keys. If RSA is used, set the KeySpec parameter to RSA_2048.
You can use elliptic-curve cryptography (ECC) to generate a digital signature. KMS supports the following two types of elliptic curves:
- NIST-recommended elliptic curve P-256. If this elliptic curve is used, set the KeySpec parameter to EC_P256.
- SECG elliptic curve secp256k1. If this elliptic curve is used, set the KeySpec parameter to EC_P256K.
- An information receiver distributes a public key to a sender.
- The sender uses the public key to encrypt sensitive information.
- The sender transmits the ciphertext generated from the sensitive information to the receiver.
- The receiver uses the private key to decrypt the ciphertext.
The private key can only be used by the information receiver, which guarantees that the plaintext of the sensitive information cannot be intercepted and decrypted by unauthorized parties during transmission. This encryption method is widely used to exchange keys. For example, session keys are exchanged in Transport Layer Security (TLS), and encryption keys are exported and imported between different hardware security modules (HSMs).
For more information, see Using asymmetric CMKs for data encryption.
- Verifying data integrity: If the data does not match its signature, the data may be tampered with.
- Verifying message authenticity: If a message does not match its signature, the message transmitter does not actually hold the private key.
- Providing non-repudiation for signatures: If the data matches its signature, the signer cannot deny this signature.
- A signer sends a public key to a receiver.
- The signer uses the private key to sign data.
- The signer sends the data and signature to the receiver.
- After receiving the data and signature, the receiver uses the public key to verify the signature.
Digital signatures are widely used to defend against data tampering and authenticate identities. For example, you can use digital signatures to protect the integrity of your binary code and verify that the code has not been manipulated to provide a trusted execution environment. Digital signatures can also be used in digital certificate systems. In such a system, a certificate authority (CA) provides a signature for digital certificates to certify the entity information, public-private key information, key purpose, expiration date, and issuer. Specifically, the private key holder of a certificate uses the private key to sign a message. The receiver uses the public key contained in the certificate to verify the message signature and uses the public key of the certificate issuer to verify the certificate.
For more information, see Using asymmetric CMKs for digital signatures.
KMS does not support automatic rotation of asymmetric CMKs. You can call the CreateKeyVersion operation to create a new key version in a specific CMK and generate a new pair of public/private keys. If you use a new key version for digital signature or data encryption, you must also distribute the new version of the public key.
In addition, unlike symmetric CMKs, the concept of primary key version (PrimaryKeyVersion) does not apply to asymmetric CMKs. Therefore, to call the operations related to asymmetric keys in KMS, you must specify the CMK ID (or CMK alias) and a key version.
Public key operation
In most cases, a public key distributed to users for encryption and verification can be obtained by calling the GetPublicKey operation. You can perform public-key operations locally by using cryptographic libraries such as OpenSSL and Java JCE in your application.
KMS also provides the AsymmetricEncrypt and AsymmetricVerify operations to help you implement your business services. To meet your special business needs, you can call the KMS APIs related to public key operations to easily record audit logs, or restrict the use of a public key by using RAM.
Private key operation
You must use the AsymmetricDecrypt and AsymmetricSign operations provided by KMS to decrypt or digitally sign data with private keys.