OpenPGP for .NET with SHA-256 User ID signatures

As of version 1.9.3.21 DidiSoft OpenPGP Library for .NET creates OpenPGP keys using SHA-256 signature for the key User ID.

What’s the purpose of the signature?

An OpenPGP Key in addition to the cipher parameters contains also additional information one of which is the User ID of the key owner, for example, “John Doe <john@gmail.com>“;  In order for this User ID to be protected against modification, a digital signature is attached to it.

In earlier versions of the library, SHA-1 was used, but it is not secure anymore so from now on SHA-256 will be the default when creating a new key with

KeyStore.Generate… RSA key, HD/DSS key, Elliptic Curve key

How to modify this setting?

Of course, this setting can be customized with the KeyStore.KeyCreationHash property, e.g.:

KeyStore ks = new KeyStore();
ks.KeyCreationHash = HashAlgorithm.SHA512;
ks.Generate ....

Cipher for encrypting the private key values

A similar property KeyStore.KeyCreationCipher exists for modifying the symmetric cipher used for encrypting the values of the private key (the encryption key is the password of the private key). The default one is AES-256.

KeyStore ks = new KeyStore();
ks.KeyCreationCipher = CypherAlgorithm.AES_256;
ks.Generate ....