【问题标题】:Amazon AWS unable to validate thawte certificate chainAmazon AWS 无法验证解冻证书链
【发布时间】:2015-02-02 10:15:25
【问题描述】:

我刚刚获得了 Thawte 123 SSL 证书,但在将其上传到 AWS 以将其与 CloudFront 一起用作自定义 SNI SSL 证书时遇到问题。 AWS 拒绝 CA 链。我将Thawte Intermediate CA bundle 用于SSL Web Server and Thawte Wildcard certificates

为了能够使用我的私钥,我将其转换为 RSA 密钥:

openssl rsa -in private.key -out private-rsa-key.pem`

并尝试通过以下方式上传:

aws iam upload-server-certificate --server-certificate-name example.com-certificate --certificate-body file://certificate.pem --private-key file://private.pem --certificate-chain https://search.thawte.com/library/VERISIGN/ALL_OTHER/thawte%20ca/SSL_CA_Bundle.pem --path /cloudfront/example.com/

导致以下错误:

A client error (MalformedCertificate) occurred when calling the UploadServerCertificate operation: Unable to validate certificate chain. The certificate chain must start with the immediate signing certificate, followed by any intermediaries in order. The index within the chain of the invalid certificate is: 0

即使将thawte_Primary_Root_CA.pem 作为第一个即时签名证书插入到证书链中,也不能解决问题。

A client error (MalformedCertificate) occurred when calling the UploadServerCertificate operation: Unable to validate certificate chain. The certificate chain must start with the immediate signing certificate, followed by any intermediaries in order. The index within the chain of the invalid certificate is: 1

Thawte CA 链是否与 AWS 不兼容?

【问题讨论】:

    标签: ssl amazon-web-services https amazon-cloudfront thawte


    【解决方案1】:

    我现在遇到同样的问题,并且尝试了所有方法。 使用 SSL123 证书(我的 rsa key 和 pem 都可以)

    我无法以任何顺序使用 Thawte 提供的主要和次要证书。 我单独尝试了primary,单独尝试了secondary,primary+secondary,secondary+primary,还尝试了root cert,还尝试了primary&secondary from:

    https://search.thawte.com/library/VERISIGN/ALL_OTHER/thawte%20ca/SSL123_SecondaryCA.pem

    https://search.thawte.com/library/VERISIGN/ALL_OTHER/thawte%20ca/SSL123_PrimaryCA.pem

    我能从 ELB 得到的唯一东西是:

    无法验证证书链。证书链必须从直接签名证书开始,然后是任何中间人。无效证书链内索引为:0

    索引并不总是 -1,也可能是 0,1 和 2,具体取决于顺序和包含的证书数量。

    [为我解决]

    显然,您从中创建证书的 EC2 实例会影响。我使用了默认 AMI 的标准 EBS 实例,并再次转换了 Thwate 提供的证书,它确实有效。

    步骤如下:

    企业社会责任:

    keytool -genkey -keysize 2048 -keyalg RSA -alias mycertificate -keystore keystore.jks
    

    一旦 Thatwe 回复:(主要是电子邮件链中的第二个证书)。

    导入keystore.jks中的三个证书

    keytool -import -alias Primary -trustcacerts -file Primary.crt -keystore keystore.jks
    keytool -import -alias Secondary -trustcacerts -file Secondary.crt -keystore keystore.jks
    keytool -import -alias mycertificate -trustcacerts -file mycertificate.cer -keystore keystore.jks
    

    JSK > P12 - 将 keystore.jks 转换为 p12 格式

    keytool -importkeystore -srckeystore keystore.jsk -destkeystore keystore.p12 -srcstoretype jks -deststoretype pkcs12

    P12 > PEM - 将 p12 格式转换为 pem 格式

    openssl pkcs12 -in keystore.p12 -out keystore.pem -nodes

    PEM > RSA PRIVATE KEY - 以 RSA 格式导出私钥

    openssl rsa -in keystore.pem -text > keystore_rsa.pem

    这次确实奏效了。

    【讨论】:

      【解决方案2】:
      1. 您必须确保证书、私钥和证书链都经过 PEM 编码,如下所示:
      -----BEGIN CERTIFICATE----- << -This is my Intermediate CA which signed my CSR 
      Base64-encoded certificate
      -----END CERTIFICATE-----
      -----BEGIN CERTIFICATE----- << -This is my Root CA which signed my Intermediate CA
      Base64-encoded certificate
      -----END CERTIFICATE-----
      
      1. 您无需将签名证书放入链中。
        只需在 Chain 文件中添加中间和根 ca 就足够了。

      【讨论】:

        【解决方案3】:
        【解决方案4】:

        请务必注意,中间证书并非特定于您的域或证书。因此,每个颁发的与您类似的证书都具有完全相同的中间证书。

        您可以将它们想象成支票上的路由号码。路由号码是必需的,但实际上更多的是关于您的银行而不是关于您的信息。在这种情况下,您的帐号或证书对您来说是独一无二的。

        由于中间证书的通用性,有这样的网站:

        https://www.ssl2buy.com/wiki/ssl-intermediate-and-root-ca-bundle

        为不同的证书颁发者预先捆绑了所有中间证书(并以正确的顺序)。

        【讨论】:

          猜你喜欢
          • 2010-11-30
          • 1970-01-01
          • 1970-01-01
          • 2010-12-03
          • 1970-01-01
          • 2020-10-29
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多