A different symmetric algo for gpgme

196 views Asked by At

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?

1

There are 1 answers

0
Alexander Gromnitsky On BEST ANSWER

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'