Modifying the state of a versioned key
To modify the state of a versioned key
Call the I_C_SetKeyParameters and pass I_T_KeyLifeCycleState and the new parameter state (restricted, retired, or active).
Example
The following code modifies version 4 of a key:
        rc = I_C_SetKeyParameter(sess, "my_versioned_key#4", I_T_KeyLifecycleState,I_T_KeyParameter_State_Restricted);
        rc = I_C_SetKeyParameter(sess, "my_versioned_key#4", I_T_KeyLifecycleState, I_T_KeyParameter_State_Retired);
        rc = I_C_SetKeyParameter(sess, "my_versioned_key#4", I_T_KeyLifecycleState, I_T_KeyParameter_State_Active);
If you don’t include the key version in the key name, the latest active version is modified.
        rc = I_C_SetKeyParameter(sess, my_versioned_key, I_T_KeyLifecycleState, I_T_KeyParameter_State_Restricted);
The above code places the latest key version in a restricted state.