【问题标题】:Force GPG in GPGME to use a cipher other than CAST5强制 GPGME 中的 GPG 使用 CAST5 以外的密码
【发布时间】:2016-01-21 11:45:13
【问题描述】:

我想使用 GPGME 加密数据(无文件)并将数据保存在数据库中。我了解到以 OpenPGP 作为协议的 GPGME 将使用 GPG 和 CAST5 加密数据。 CAST5,如果我使用以下命令检查 gpg2,这就是我的命令行告诉我的:

LANG=C gpg2 --verbose --symmetric
gpg: using cipher CAST5

我不知道为什么它不使用new AES-128 default value。但我想我没有可用的最新版本(我的 debian 系统中的包管理器也没有)。

我真的很想通过在herehomepage of GPG 提到的 gpg.conf 文件中设置相应的值来配置 GPG 以使用 AES 进行加密。所以我尝试通过使用gpgme_get_engine_info 并查看home_dir 来获取有关文件位置的信息,但这个路径似乎是空的。 file_nameusr/bin/gpg2。但是,没有 gpg.conf。严格来说,我的系统中根本没有 gpg.conf。 那么如果这个文件丢失了怎么办呢?或者有没有办法使用 GPGME 以编程方式设置值?我只找到了

gpgme_ctx_set_engine_info (gpgme_ctx_t ctx, gpgme_protocol_t proto, const char *file_name, const char *home_dir)

所以我可以创建一个新配置并使用此函数设置路径。但这假设我知道这个文件的样子。可惜我没有。

【问题讨论】:

    标签: c++ encryption gnupg gpgme


    【解决方案1】:

    我发现了一个 pgp.conf 文件的good example,它显示了如何设置密码和散列函数的首选值。这是摘录:

    # list of personal digest preferences. When multiple digests are supported by
    # all recipients, choose the strongest one
    personal-cipher-preferences AES256 AES192 AES CAST5
    
    # list of personal digest preferences. When multiple ciphers are supported by
    # all recipients, choose the strongest one
    personal-digest-preferences SHA512 SHA384 SHA256 SHA224
    
    # message digest algorithm used when signing a key
    cert-digest-algo SHA512
    
    # This preference list is used for new keys and becomes the default for
    # "setpref" in the edit menu
    default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-01
      • 1970-01-01
      • 2021-05-06
      • 1970-01-01
      • 2017-08-01
      • 1970-01-01
      相关资源
      最近更新 更多