Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
默认情况下,gpg2 使用 CAST5 进行对称加密。这里
crypto = GPGME::Crypto.new() r = crypto.encrypt "Hello world!\n", symmetric: true
r.read()将返回 CAST5 数据。
r.read()
如何将默认密码算法更改为例如 AES256?
好吧,显然不可能通过 API 更改密码,但可以使用间接技巧。
创建一个 tmp 目录/foo/bar并将其放入gpg.conf带有以下行的文件:
/foo/bar
gpg.conf
personal-cipher-preferences aes256
为 gpgme 设置一个“主”目录(之前GPGME::Crypto.new):
GPGME::Crypto.new
GPGME::Engine.home_dir = '/foo/bar'