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 sample alters state of a key version.
// This line activates version of a key. Active version of a key can be used for encryption
// decryption, signing, sign verification, mac, and mac verification.
aesKey.modifyVersion(4, "Active")
// This line restricts version of a key. Restricted version of a key can be used for
decryption,
// sign verification, and mac verification.
aesKey.modifyVersion(2, "Restricted")
// This line retires version of a key. Retired version of a key cannot be used for any crypto
operation.
aesKey.modifyVersion(7, "Retired")