【问题标题】:What is the equivalent of Unix c_rehash command/script on Linux?Linux 上 Unix c_rehash 命令/脚本的等价物是什么?
【发布时间】:2014-11-11 10:00:47
【问题描述】:

我正在按照有关如何导入 a certificate with its whole chain into a keystore 的说明进行操作。 我面临的问题是我的系统上没有 c_rehash:

user@hostanme$ c_rehash ./certs
-bash: c_rehash: command not found

我找到了-subject_hash option of openssl x509,但我不确定如何使用它来复制 c_rehash 所做的任何事情。

如何在没有 c_rehash 命令/脚本的情况下对证书目录进行哈希处理?

【问题讨论】:

    标签: ssl openssl ssl-certificate


    【解决方案1】:

    c_rehash 需要“perl”才能执行。 如果您无法运行 c_rehase,请尝试以下操作。

    在 Shell 文件中使用“openssl”

    for file in *.pem; do ln -s "$file" "$(openssl x509 -hash -noout -in "$file")".0; done
    

    【讨论】:

    • 需要更多引号才能正确 - 如果您的证书名称中有空格,这将无法正常工作。考虑ln -s "$file" "$(openssl x509 -hash -noout -in "$file")"
    【解决方案2】:

    c_rehash 命令在 openssl-perl 包中可用

    来源:https://bugzilla.redhat.com/show_bug.cgi?id=461123 在 RHEL7 上验证

    【讨论】:

      【解决方案3】:

      user@hostanme$ c_rehash ./certs
      -bash: c_rehash: 找不到命令

      您要么需要安装 OpenSSL(可能是开发人员版本),要么需要将其 bin/ 目录放在路径上:

      $ find /usr -iname c_rehash
      /usr/bin/c_rehash
      /usr/local/ssl/darwin/bin/c_rehash
      /usr/local/ssl/macosx-x64/bin/c_rehash
      /usr/local/ssl/macosx-x86/bin/c_rehash
      

      并确保您使用正确的。如果我没记错的话,OpenSSL 0.9.8 使用 MD5,而 OpenSSL 1.0.0 及更高版本使用 SHA1。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2010-12-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-08-25
        相关资源
        最近更新 更多