Key Management Service (KMS) supports common symmetric and asymmetric keys and ensures the security of encrypted data. This topic describes the key specifications in KMS by key type.
Key specifications supported for symmetric encryption
Symmetric encryption is commonly implemented to protect sensitive data. You can use the same key to encrypt and decrypt data. KMS keeps the key material of a symmetric key confidential to prevent the symmetric key from being used by authorized users or being stolen. This ensures the security of encrypted data.
In most cases, symmetric keys are used for data encryption. The following table describes the key specifications that are supported by different types of symmetric keys.
Key type  Key specification  Data encryption mode  Padding mode 
Default key  Aliyun_AES_256  Galois/Counter Mode (GCM) (default)  N/A. 
Softwareprotected key  Aliyun_AES_256  GCM (default)  N/A. 
Hardwareprotected key 
 GCM (default), electronic codebook (ECB), and cipher block chaining (CBC) 

If you call the CreateKey operation to create a key but do not specify the KeySpec parameter, KMS creates a symmetric key whose key specification is Aliyun_AES_256.
Key specifications supported for asymmetric encryption
An asymmetric key consists of a public key and a private key that are mathematically related to each other. The public key is available for all users, but the private key can be used only by the owner or trusted users.
After you create an asymmetric key in KMS, you can obtain the public key in the KMS console or by calling the GetPublicKey operation. KMS ensures the security of the private key and does not support the export of private keys by calling operations.
In most cases, asymmetric key pairs are used for signing and verification or to encrypt and transmit a small amount of confidential information, such as symmetric keys. You can specify the key purpose when you create an asymmetric key.
If the key purpose is ENCRYPT/DECRYPT, you can call the Encrypt operation to encrypt data by using the public key and call the Decrypt operation to decrypt data by using the private key.
If the key purpose is SIGN/VERIFY, you can call the Sign operation to generate a digital signature by using the private key and call the Verify operation to verify the signature by using the public key.
Asymmetric encryption is computationally intensive. In most cases, asymmetric cryptographic operations are used to encrypt data in small pieces such as securely distributing symmetric keys.
The following table describes the key specifications that are supported by different types of asymmetric keys.
Key type  Key specification  Supported encryption algorithm  Supported signature algorithm 
Softwareprotected key  RSA_2048 and RSA_3072  RSAES_OAEP_SHA_256 (default value)  RSA_PSS_SHA_256 (default) and RSA_PKCS1_SHA_256 
EC_P256 and EC_P256K  ECIES_DH_SHA_1_XOR_HMAC (default value)  ECDSA_SHA_256 (default value)  
Hardwareprotected key  RSA_2048, RSA_3072, and RSA_4096  RSAES_OAEP_SHA_256 (default value)  RSA_PSS_SHA_256 (default) and RSA_PKCS1_SHA_256 
EC_P256 and EC_P256K  ECIES_DH_SHA_1_XOR_HMAC (default value)  ECDSA_SHA_256 (default value) 
Encryption algorithm description:
RSAES_OAEP_SHA_256: the RivestShamirAdleman (RSA) encryption algorithm that uses MGF1 and SHA256 with RSAESOAEP padding defined in PKCS #1 in RFC 3447.
ECIES_DH_SHA_1_XOR_HMAC: follows SEC 1: Elliptic Curve Cryptography, Version 2.0, uses Ellipticcurve Diffieâ€“Hellman (ECDH) for key agreement, uses key derivation function 2 (KDF2) with SHA1 for key derivation, uses HMACSHA1 as the Message Authentication Code (MAC) algorithm, and uses XOR for symmetric encryption.
Signature algorithm description:
RSA_PSS_SHA_256: uses the SHA256 algorithm to calculate hash values and uses MGF1 with SHA256 to calculate signatures based on the RSASSAPSS algorithm defined in PKCS #1 in RFC 3447.
RSA_PKCS1_SHA_256: uses the SHA256 algorithm to calculate hash values and calculate signatures based on the RSASSAPKCS1v1_5 algorithm defined in PKCS #1 in RFC 3447.
ECDSA_SHA_256: the Elliptic Curve Digital Signature Algorithm (ECDSA) to calculate signatures and SHA256 to calculate hash values.