AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1148261
Accepted
Stephan Windmüller
Stephan Windmüller
Asked: 2023-11-21 05:00:05 +0800 CST2023-11-21 05:00:05 +0800 CST 2023-11-21 05:00:05 +0800 CST

openssl 忽略 pkcs12 文件中的中间证书

  • 772

创建新的 S/MIME 证书后,我一直致力于创建大多数邮件客户端接受的有效 PKCS #12 文件:

$ openssl verify smime.pfx
CN = [email protected], emailAddress = [email protected]
error 20 at 0 depth lookup: unable to get local issuer certificate
error smime.pfx: verification failed

如果我指定中间证书,链看起来不错:

openssl verify -show_chain -untrusted Certum_SMIME_RSA_CA.pem smime.pfx
smime.pfx: OK
Chain:
depth=0: CN = [email protected], emailAddress = [email protected] (untrusted)
depth=1: C = PL, O = Asseco Data Systems S.A., CN = Certum SMIME RSA CA (untrusted)
depth=2: C = PL, O = Asseco Data Systems S.A., OU = Certum Certification Authority, CN = Certum Trusted Root CA

但是,在创建 pfx 文件时已指定该文件:

$ openssl pkcs12 -export -inkey privatekey.key -in smime.pem \
    -certfile Certum_SMIME_RSA_CA.pem -out smime.pfx

根据 openssl,存在中间证书:

$ openssl pkcs12 -in smime.pfx -nodes | grep -E "subject|issuer"
subject=CN = [email protected], emailAddress = [email protected]
issuer=C = PL, O = Asseco Data Systems S.A., CN = Certum SMIME RSA CA
subject=C = PL, O = Asseco Data Systems S.A., CN = Certum SMIME RSA CA
issuer=C = PL, O = Asseco Data Systems S.A., OU = Certum Certification Authority, CN = Certum Trusted Root CA

那么我到底错过了什么?为什么作为 pfx 文件一部分的中间证书被忽略?

openssl
  • 1 1 个回答
  • 38 Views

1 个回答

  • Voted
  1. Best Answer
    dave_thompson_085
    2023-11-21T11:51:52+08:002023-11-21T11:51:52+08:00

    从手册页:

    openssl verify [options skipped] [–] [certificate ...]
    
    [option descriptions skipped]
    
    certificate ...
    
        One or more target certificates to verify, one per file. If no certificates are given, this 
        command will attempt to read a single certificate from standard input.
    

    注意“每个文件一个”。为该证书构建链所需的证书将在-untrusted和(如果指定)中查找-trusted,并且在(如果指定)中查找,或者如果未指定-CAfile/path/store相关选项,则在各自的默认值中查找 - 但不在输入文件中。-no

    仅 3.0.0 及以上版本(自 2021 年起)支持使用 PKCS12-aka-PFX 文件作为输入verify,但尝试 PEM 格式“链”文件的等效错误verify长期以来一直很常见;请参阅https://stackoverflow.com/questions/65204616/why-does-openssl-verify-fail-with-a-certificate-chain-file-while-it-succeeds-wit以及更多链接。

    • 1

相关问题

  • 在 LAMPP 中升级单个库(特别是 openssl)

  • 带有基于商业 CA 的客户端证书的 ssl_error_handshake_failure_alert

  • 我可以对 *.domain.com 和 domain.com 使用相同的通配符认证吗

  • 为 apache 生成自签名 SSL 证书

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve