New features in OpenPGP for .NET 1.8.2.2

In version 1.8.2.2 of DidiSoft OpenPGP Library for .NET version you will find support for 2048 and 3076 bit DSA master signing keys, Elliptic Curve OpenPGP keys based on the Brainpool curves and some other extras.

Brainpool ECC keys

With the new version we can create an Elliptic Curve OpenPGP key just like the standard ECC keys based on NIST curves :

C# example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System;
using DidiSoft.Pgp;
 
public class GenerateEccKeyPairDemo
{
   public void Demo()			
   {
       KeyStore ks = new KeyStore();
 
       // EC curve for this key   
       EcCurve curve = EcCurve.Brainpool256;
       // primary User Id of the key
       string userId = "Demo <demo@didisoft.com>";
       // password for the private key
       string privateKeyPassword = "changeit";
 
       ks.GenerateEccKeyPair(curve, userId, privateKeyPassword);
   }
}

VB.NET example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Imports System
Imports DidiSoft.Pgp
 
Public Class GenerateEccKeyPairDemo
   Public Sub Test()
       Dim ks As New KeyStore()
 
       '  EC curve for this key
       Dim curve As EcCurve = EcCurve.Brainpool256
       ' primary User Id of the key
       Dim userId As String = "Demo <demo@didisoft.com>"
       ' password for the private key
       Dim privateKeyPassword As String = "changeit"
 
       ks.GenerateEccKeyPair(curve, userId, privateKeyPassword)
   End Sub
End Class

Large DSA based keys

Large DH/DSS (DSA) based keys can be generated with the method KeyStore.GenerateDhDssKeyPair. Here we can specify the size of the master signing key (DSA key) and the encryption key Diffie-Hellman (DH key) separately. And overloaded version of the more general KeyStore.GenerateKeyPair has also be added for specifying separately the size of the encryption and signing keys, or the Elliptic curves respectively for ECC OpenPGP keys.

Brainpool ECC keys in PowerShell

Brainpool curves based OpenPGP keys can be created in PowerShell now too:

New-PgpKeyEcc -Curve Brainpool-512 -Name “Richard Koosh” -Password “my key pass” -Output c:\my_key.asc

What symmetric cipher was used?

Did you wondered what is the symmetric cipher used to encrypt the data in a given pgp archive? Now you can find out with the help of DidiSoft.Pgp.Inspect.PGPInspectLib:

1
2
3
4
5
6
7
8
9
10
11
FileInfo pgpFile = new FileInfo(OutputFolder + "output.pgp");
pgpFile.Delete();
pgp.EncryptFile(SmallText, PublicKey, pgpFile, true, true);
 
using (Stream dataStream = pgpFile.OpenRead())
using (Stream keyStream = PrivateKey.OpenRead())
{
	DidiSoft.Pgp.Inspect.PGPInspectLib inspect = new DidiSoft.Pgp.Inspect.PGPInspectLib();
 
	Console.WriteLine(inspect.GetEncryptionCypher(dataStream, keyStream, Password));
}

What else

Check the Release notes for all the new additions or drop us a line if you have any comments a questions?