Alter State of a Key Version
Call the
modifyVersion
method of theSecretKey
.Pass the key version number and the new state as arguments.
Code sample
The following code samples alters state of a key version.
// Activate a key version.
aesKey.modifyVersion(4, "Active")
Active version of a key can be used for encryption, decryption, signing, sign verification, mac, and mac verification.
// Restricts a key version.
aesKey.modifyVersion(2, "Restricted")
Restricted version of a key can be used for decryption, sign verification, and mac verification.
// Retires a key version.
aesKey.modifyVersion(7, "Retired")
Retired version of a key cannot be used for any crypto operation.