Exporting a Key
You can export both the symmetric and asymmetric keys. To export a key:
Call the
ExportKey
method from theNaeKeyManagement
class.NaeKeyManagement nkm = new NaeKeyManagement(session);
Pass the key name and key type as an argument that you want to export.
nkm.ExportKey("Example_Rijndael_key", NaeKeyManagement.KeyType.None);
The enum
KeyType
is defined as:public enum KeyType { Public = 0, PublicPrivate = 1, None = 2 }
For symmetric keys, use
KeyType.None
.For asymmetric keys, use
KeyType.Public
to get only the public key. UseKeyType.PublicPrivate
to get both public and private keys.