By default all encrypt methods use CAST 5 as an internal symmetric key encryption algorithm, form maximum compatibility with other OpenPGP solutions. This can be changed through a setter method PGPLib.setCypher( string cypher). The accepted values that can be passed for the cypher parameter are listed in the CypherAlgorithm interface:
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
Here is how to set the default symmetric algorithm to 128 bit AES :
PGPLib pgp = new PGPLib(); pgp.setCypher(CypherAlgorithm.AES_128);
Have in mind that if the public key we use for encryption does not support the preferred symmetric algorithm, then the first cypher from this key preferred list will be used (each OpenPGP key stores internally it’s algorithm preferences).