Creating a Key
CADP for .NET Core supports creation of the following keys:
AES
DESede
HMAC
RSA
EC
For example, let's create a 128-bit AES key:
Create a new key object of NaeRijndaelKey.
NaeRijndaelKey rijndaelKey = new NaeRijndaelKey(session);
Set the key size to 128-bit.
rijndaelKey.KeySize = 128;
Set the key properties to make the key deletable and exportable.
rijndaelKey.IsDeletable = true; rijndaelKey.IsExportable = true;
Generate the key using GenerateKey() function and specify the key name.
rijndaelKey.GenerateKey(keyName);
It creates a key on the CipherTrust Manager server with the specified key name.
Similarly, you can create DESede, RSA, HMAC, EC, and AES/GCM keys using NaeTripleDesKey, NaeRsaKey, NaeHmacKey,NaeECIESKey, and NaeAesGcm classes respectively.
Note
For AES/GCM key, there is an additional property named as TagLen
, range: 12-16 bytes.
To create a versioned key, append the key name with #. For Example, GenerateKey("keyName#");