We can change the preferred symmetric encryption algorithm (cypher) used by DidiSoft OpenPGP Library for .NET through the Cypher property of the PGPLib class. By default CAST 5 symmetric encryption algorithm is used.
The example below demonstrates how to set explicitly a preferred symmetric encryption algorithm for an instance of the library:
PGPLib pgp = new PGPLib(); pgp.OverrideKeyAlgorithmPreferences = true; pgp.Cypher = CypherAlgorithm.AES_128;
Dim pgp As New PGPLib() pgp.OverrideKeyAlgorithmPreferences = True pgp.Cypher = CypherAlgorithm.AES_128
Without setting the OverrideKeyAlgorithmPreferences property the library will ignore this setting if the public key used for encryption does not list this algorithm in it’s preferred cyphers list (most OpenPGP public key holds such an information internally in a special signature). In that case the library will automatically pick the first algorithm from the public key list.
Below is a list of the supported symmetric key algorithms:
CypherAlgorithm.TRIPLE_DES CypherAlgorithm.CAST5 CypherAlgorithm.BLOWFISH CypherAlgorithm.AES_128 CypherAlgorithm.AES_192 CypherAlgorithm.AES_256 CypherAlgorithm.TWOFISH CypherAlgorithm.DES CypherAlgorithm.SAFER CypherAlgorithm.IDEA CypherAlgorithm.CAMELLIA_128 CypherAlgorithm.CAMELLIA_192 CypherAlgorithm.CAMELLIA_256
The Camellia ciphers were added in version 188.8.131.52.