- Create a symmetric key if you need to encrypt and decrypt data with the same key material or generate data keys for envelope encryption.
- Create an asymmetric key if you need a public-private key pair.
Prerequisites
Make sure you are in a group that has at least theeditor role within your tenant or project; for example, the default editors group. You can check this in the Administration → IAM section of the web console.
How to create a symmetric key
Create a symmetric key:-
--name: Name of the key. -
--description(optional): Description of the key. -
--algorithm: Key encryption algorithm. You can only specify the algorithm when you create a key. You can’t update it later. The only supported value isaes_256. -
--rotation-period(optional): Period after which KMS automatically rotates the key material. When a key is rotated, KMS generates a new key version and immediately sets it as the default version. Specify the value in theNhNmNsformat, for example,24hor48h30m10s. The minimum value is86400s(one day) and the maximum value is315360000s(3650 days). The default value is7776000s(90 days).
How to create an asymmetric key
Create an asymmetric key:-
--name: Name of the key. -
--description(optional): Description of the key. -
--algorithm: Cryptographic algorithm to use with the key. You can only specify the algorithm when you create a key. You can’t update it later. The supported values are:ecdsa_nist_p256_sha_256ecdsa_nist_p384_sha_384rsa_4096_enc_oaep_sha_256