Key management types and key specifications
In scenarios such as data encryption and digital signatures, you can select an appropriate key management type and key specification based on compliance requirements (such as national cryptography compliance), performance needs, or security levels. After you purchase the national cryptography software module, software-protected keys support the Aliyun_SM4 specification. This topic describes the key specifications supported by each key management type.
Supported symmetric key specifications
Symmetric key encryption is one of the most common methods to protect sensitive data. The same key material is used for both encryption and decryption. KMS securely stores the key material of symmetric keys to prevent unauthorized theft or use, which ensures the security of encrypted data.
Key specifications
The following table lists the key specifications supported by each key management type for symmetric keys.
When you call the CreateKey operation to create a key without specifying KeySpec, KMS creates a symmetric key with the Aliyun_AES_256 specification by default.
HMAC keys require KMS instance version 4.1.0 or later. Otherwise, the console prompts you to upgrade the instance image. HMAC keys do not support automatic key rotation.
Key management type | Key specification | Supported encryption algorithm | Supported key usage | Padding mode |
Default key | Aliyun_AES_256 | GCM (default) | ENCRYPT/DECRYPT | N/A |
Software-protected key | Aliyun_AES_256 | GCM (default) | ENCRYPT/DECRYPT | N/A |
Aliyun_SM4 Note This specification requires the national cryptography module. | GCM (default) | ENCRYPT/DECRYPT | N/A | |
HMAC_224 | HMAC_SHA_224 | SIGN/VERIFY | N/A | |
HMAC_256 | HMAC_SHA_256 | SIGN/VERIFY | ||
HMAC_384 | HMAC_SHA_384 | SIGN/VERIFY | ||
HMAC_512 | HMAC_SHA_512 | SIGN/VERIFY | ||
Hardware-protected key |
| GCM (default), ECB, CBC | ENCRYPT/DECRYPT |
|
Aliyun_SM4 | GCM (default) | ENCRYPT/DECRYPT | N/A | |
HMAC_SM3 | HMAC_SM3 | SIGN/VERIFY | ||
HMAC_256 | HMAC_SHA_256 | SIGN/VERIFY | ||
External key | Aliyun_AES_256 | GCM (default), ECB, CBC | ENCRYPT/DECRYPT |
|
Aliyun_SM4 | GCM (default) | ENCRYPT/DECRYPT | N/A |
Technical standards
Aliyun_AES_256: AES key, 256 bits. Complies with the technical standard "Advanced Encryption Standard (AES)" (FIPS PUB 197).
Aliyun_AES_192: AES key, 192 bits. Complies with the technical standard "Advanced Encryption Standard (AES)" (FIPS PUB 197).
Aliyun_AES_128: AES key, 128 bits. Complies with the technical standard "Advanced Encryption Standard (AES)" (FIPS PUB 197).
Aliyun_SM4: SM4 key, 128 bits. Complies with the technical standards "GB/T 32907-2016 Information Security Technology SM4 Block Cipher Algorithm" and "GM/T 0002-2012 SM4 Block Cipher Algorithm".
HMAC_224: HMAC key using the SHA-224 hash algorithm with a 224-bit MAC output. Complies with the technical standard "The Keyed-Hash Message Authentication Code (HMAC)" (FIPS 198-1).
HMAC_256: HMAC key using the SHA-256 hash algorithm with a 256-bit MAC output. Complies with the technical standard "The Keyed-Hash Message Authentication Code (HMAC)" (FIPS 198-1).
HMAC_384: HMAC key using the SHA-384 hash algorithm with a 384-bit MAC output. Complies with the technical standard "The Keyed-Hash Message Authentication Code (HMAC)" (FIPS 198-1).
HMAC_512: HMAC key using the SHA-512 hash algorithm with a 512-bit MAC output. Complies with the technical standard "The Keyed-Hash Message Authentication Code (HMAC)" (FIPS 198-1).
HMAC_SM3: HMAC key using the SM3 hash algorithm. Complies with the technical standard "The Keyed-Hash Message Authentication Code (HMAC)" (FIPS 198-1) and "GM/T 0004-2012 SM3 Cryptographic Hash Algorithm".
Supported asymmetric key specifications
An asymmetric key consists of a cryptographically related public key and private key pair. The public key can be freely distributed, while the private key must remain securely protected and accessible only to the owner or trusted parties.
For asymmetric keys created in KMS, the public key can be obtained through the GetPublicKey operation or the KMS console. KMS ensures the security of private keys and does not provide any operation to export them.
Asymmetric keys are typically used for digital signature verification or for encrypting and distributing small amounts of data such as symmetric keys. Set the key usage when you create an asymmetric key.
When the key usage is ENCRYPT/DECRYPT, you can call the Encrypt operation of KMS to encrypt data by using the public key, and call the Decrypt operation to decrypt data by using the private key.
When the key usage is SIGN/VERIFY, you can call the Sign operation of KMS to compute digital signatures by using the private key, and call the Verify operation to verify signatures by using the public key.
Due to the high computational cost of asymmetric cryptographic operations, use asymmetric keys only for small data blocks such as securely distributing symmetric keys.
Key specifications
The following table lists the key specifications supported by each key management type for asymmetric keys.
Key management type | Key specification | Supported encryption algorithm | Supported signature algorithm |
Software-protected key | RSA_2048, RSA_3072, RSA_4096 | RSAES_OAEP_SHA_256 (default) | RSA_PSS_SHA_256 (default), RSA_PKCS1_SHA_256 |
EC_P256, EC_P256K | ECIES_DH_SHA_1_XOR_HMAC (default) | ECDSA_SHA_256 (default) | |
ML_DSA_44, ML_DSA_65, ML_DSA_87 Note This specification requires the post-quantum module, and the instance version must be dkms-4.6.0 or later. | Not supported | ML_DSA_SHAKE_256 | |
Hardware-protected key | RSA_2048, RSA_3072, RSA_4096 | RSAES_OAEP_SHA_256 (default) | RSA_PSS_SHA_256 (default), RSA_PKCS1_SHA_256 |
EC_P256, EC_P256K | ECIES_DH_SHA_1_XOR_HMAC (default) | ECDSA_SHA_256 (default) | |
EC_SM2 | SM2PKE (default) | SM2DSA (default) | |
ML_DSA_44, ML_DSA_65, ML_DSA_87 Note This specification requires the post-quantum module. You must also contact Alibaba Cloud engineers to upgrade the instance image and the HSM firmware. | Not supported | ML_DSA_SHAKE_256 |
Technical standards
RSA_2048: RSA key pair with a modulus length of 2048 bits. Complies with the technical standard "PKCS #1: RSA Cryptography Specifications Version 2.2".
RSA_3072: RSA key pair with a modulus length of 3072 bits. Complies with the technical standard "PKCS #1: RSA Cryptography Specifications Version 2.2".
RSA_4096: RSA key pair with a modulus length of 4096 bits. Complies with the technical standard "PKCS #1: RSA Cryptography Specifications Version 2.2".
EC_P256: Elliptic Curve Cryptography (ECC) key pair using the P-256 curve recommended by NIST, also known as secp256r1 or ANSI prime256v1 in other standards. Complies with the technical standard "NIST SP800-186 Recommendations for Discrete Logarithm-based Cryptography".
EC_P256K: Elliptic Curve Cryptography (ECC) key pair using the secp256k1 curve recommended by SECG. Complies with the technical standard "SEC 2: Recommended Elliptic Curve Domain Parameters".
EC_SM2: SM2 algorithm key pair. Complies with the technical standards "GB/T 32918-2016 Information Security Technology SM2 Elliptic Curve Public Key Cryptography Algorithm" and "GM/T 0003-2012 SM2 Elliptic Curve Public Key Cryptography Algorithm".
ML_DSA_44, ML_DSA_65, ML_DSA_87: Module-Lattice-Based Digital Signature Algorithm (ML-DSA) key pairs that correspond to NIST security categories 2, 3, and 5, respectively. Complies with the technical standard "Module-Lattice-Based Digital Signature Standard" (FIPS 204).
Encryption algorithms
RSAES_OAEP_SHA_256: RSA encryption using the RSAES-OAEP mode as defined in RFC 3447/PKCS#1, with MGF1 and SHA-256.
ECIES_DH_SHA_1_XOR_HMAC: Complies with the SEC 1: Elliptic Curve Cryptography, Version 2.0 standard. Uses ECDH for key agreement, KDF2 with SHA-1 for key derivation, HMAC-SHA-1 as the MAC algorithm, and XOR for symmetric encryption.
SM2PKE: SM2 elliptic curve public key encryption algorithm, compliant with the standard "GM/T 0003.4 SM2 Elliptic Curve Public Key Cryptography Algorithm Part 4: Public Key Encryption Algorithm".
Signature algorithms
RSA_PSS_SHA_256: Computes the SHA-256 hash of the data and the signature using the RSASSA-PSS algorithm as defined in RFC 3447/PKCS#1, with MGF1 (SHA-256).
RSA_PKCS1_SHA_256: Computes the SHA-256 hash of the data and the signature using the RSASSA-PKCS1-v1_5 algorithm as defined in RFC 3447/PKCS#1.
ECDSA_SHA_256: ECDSA digital signature using the SHA-256 hash algorithm.
SM2DSA: SM2 elliptic curve digital signature algorithm, compliant with the standard "GM/T 0003.2 SM2 Elliptic Curve Public Key Cryptography Algorithm Part 2: Digital Signature Algorithm".
ML_DSA_SHAKE_256: ML-DSA digital signature that uses the SHAKE256 algorithm to compute the message digest, compliant with the standard "Module-Lattice-Based Digital Signature Standard" (FIPS 204).