Fetching Key Version using ID
To fetch a key version using ID:
Call the
GetKeyVersionByIdmethod from theNaeKeyManagementclass.Pass
IDandKeyIdTypeas parameters.
This API supports UUID only, therefore KeyIdType can only be KeyIdType.UUID as shown below.
NaeKeyManagement nkm = new NaeKeyManagement(session);
VersionInfo keyDetails = nkm.GetKeyVersionById("0d6b9293-de25-42a0-912f-f299b8c25639", NaeKeyManagement.KeyIdType.UUID);
The return type of a GetKeyVersionById is VersionInfo. The VersionInfo class consists of the following properties.
int Version
byte[] Header
string KeyName
For non-versioned keys, the returned version will be -1 with Null header bytes.
Note
Irrespective of caching enabled or disabled in the Properties file, the GetKeyVersionById API will always fetch information from the CipherTrust Manager.