The new version of DidiSoft OpenPGP Library for .NET 1.8.5 starts with some new features that simplify key management and enhanced key export.
Below you can see some short code samples illustrating the new features:
KeyStore access by Index
DidiSoft.Pgp.KeyStore items can now be accessed by index. Two new properties have been added to allow this:
KeyStore[index] – access to the keys by insertion order
KeyStore.Count – count of key pairs inside the KeyStore
1 2 3 | KeyStore ks = KeyStore.OpenFile(...); int numberOfKeys = ks.Count; KeyPairInformation key = ks[1]; // from 0 up to Count-1 |
Additional signing sub keys
Additional signing sub keys can be added with the help of a new method: KeyStore.AddSigningSubKey
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | using System; using DidiSoft.Pgp; public class AddEncryptionSubKey { public static void Demo() { // initialize the key store KeyStore keyStore = new KeyStore(@"DataFiles\key.store", "changeit"); // User Id of the signing key, this is usually our private key String signUserId = "support@didisoft.com"; String privateKeyPassword = "changeit"; // add ECC sub key KeyPairInformation.SubKey newKey2 = keyStore.AddSigningSubKey(signUserId, privateKeyPassword, EcCurve.P521); } } |
Partial private key export
In recent versions of GnuPG, private keys can be exported partially without the master private key material. Such key can be utilized only through its sub keys, but cannot sign other keys.
An example illustrating this can be found here: Exporting partial private keys
Upgrade from previous versions
Version 1.8.5 is 100% code level compatible with all previous 1.8 versions. Just rebuild and redeploy your applications with the new assembly DLL’s.