0

By default, gpg2 uses CAST5 for a symmetric encryption. Here

crypto = GPGME::Crypto.new()
r = crypto.encrypt "Hello world!\n", symmetric: true

r.read() will return CAST5 data.

How to change the default cipher algo to, for example, AES256?

Alexander Gromnitsky
  • 2,949
  • 2
  • 33
  • 38

1 Answers1

0

Well, apparently it's not possible to change the cipher through the API, but is possible w/ an indirect trick.

  1. Create a tmp directory /foo/bar & put in it gpg.conf file w/ the line:

    personal-cipher-preferences aes256
    
  2. Set a 'home' directory for gpgme (before GPGME::Crypto.new):

    GPGME::Engine.home_dir = '/foo/bar'
    
Alexander Gromnitsky
  • 2,949
  • 2
  • 33
  • 38