DidiSoft OpenPGP Library for .NET version 1.9.3 offers support for the creation of Elliptic Curve Cryptography (ECC) PGP keys based on Curve-25519.
What is Curve-25519?
Curve-25519 is one of the fastest ECC curves and is not covered by any known attack patents.
The first Elliptic Curves introduced in OpenPGP standard were the NIST curves. Their first alternative was the set of Brainpool curves that unfortunately suffered in performance.
Curve-25519 comes as a higher speed, high-security alternative to the NIST curves.
Creating a Curve-25519 key pair
The example below will create an OpenPGP key pair with a master key based on EdDsa over Curve 25519 and an encryption subkey based on Elliptic Curve Diffie-Hellman (ECDH) over Curve-25519.
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.Curve25519; // primary User Id of the key string userId = "Demo <demo@didisoft.com>"; // password for the private key string privateKeyPassword = "changeit"; KeyPairInformation newKey = 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.Curve25519 ' primary User Id of the key Dim userId As String = "Demo <demo@didisoft.com>" ' password for the private key Dim privateKeyPassword As String = "changeit" Dim newKey As KeyPairInformation = ks.GenerateEccKeyPair(curve, userId, privateKeyPassword) End Sub End Class |
Curve-22519 cryptography operations
Cryptography operations with keys based on Curve-22519 are available transparently without any need for code modifications.