这个代码签名证书是否适用于签署小程序?

3
我们购买了一个用于签署小程序的代码签名证书,但是当我们签署小程序时出现了以下错误。
    C:\CM\WEB-INF>jarsigner -keystore code_signing.keystore C:\CM\SweetApplet.jar code_signing_real
Enter Passphrase for keystore:
    jarsigner: Certificate chain not found for: code_signing_real.  code_signing_real must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.

我们的证书不正确吗?以下是有疑问的证书。错误消息似乎表明证书必须包含私钥,但我们不明白为什么会这样,因为私钥永远不应该暴露给除我们之外的任何人。

C:\CM\WEB-INF>keytool -list -keystore code_signing.keystore -alias code_signing_real -v
Enter keystore password:
Alias name: code_signing_real
Creation date: Mar 13, 2014
Entry type: trustedCertEntry

Owner: CN=CE, OU=CE, O=CE, L=PAL
O ALTO, ST=California, C=US
Issuer: CN=Thawte Code Signing CA - G2, O="Thawte, Inc.", C=US
Serial number: 728b78e4ded46af26494c59690e428f0
Valid from: Wed Mar 12 17:00:00 PDT 2014 until: Fri Mar 11 15:59:59 PST 2016
Certificate fingerprints:
         MD5:  E0:DB:9E:DC:37:1E:C2:A9:EA:C0:A8:21:22:61:9F:DD
         SHA1: F9:C3:75:37:CA:86:4D:E2:11:BE:52:79:CE:FA:B3:6B:32:F0:CF:D2
         Signature algorithm name: SHA1withRSA
         Version: 3

Extensions:

#1: ObjectId: 2.5.29.19 Criticality=true
BasicConstraints:[
  CA:false
  PathLen: undefined
]

#2: ObjectId: 1.3.6.1.5.5.7.1.1 Criticality=false
AuthorityInfoAccess [
  [accessMethod: 1.3.6.1.5.5.7.48.1
   accessLocation: URIName: http://ocsp.thawte.com]
]

#3: ObjectId: 2.5.29.4 Criticality=false

#4: ObjectId: 2.5.29.31 Criticality=false
CRLDistributionPoints [
  [DistributionPoint:
     [URIName: http://cs-g2-crl.thawte.com/ThawteCSG2.crl]
]]

#5: ObjectId: 2.5.29.37 Criticality=false
ExtendedKeyUsages [
  codeSigning
  1.3.6.1.4.1.311.2.1.22
]

#6: ObjectId: 2.16.840.1.113730.1.1 Criticality=false
NetscapeCertType [
   Object Signing
]
1个回答

2

它并没有说证书必须包含私钥。证书不包含私钥。请再读一遍。它说的是密钥条目必须包含私钥和证书。

因此,无论您如何构建此KeyStore,它都是无效的。可能您只是将已签名的证书导入了新的KeyStore或使用了新的别名。您必须将其导入到原始KeyStore中,在其中存在私钥的相同别名下。

您还必须将证书链作为另一个别名的可信CA证书导入。


1
是的,就是这个。经过数小时的头痛之后,我们终于在这个网址https://support.globalsign.com/customer/portal/articles/1352403找到了答案。真希望我们早点发布这个问题,让你有机会更早地回答它。 :) - Crashalot
我本来早就可以睡觉了。但是答案在JSSE参考指南中。 - user207421
对我来说,Crashalot的评论是正确的答案! - jbiWeisendorf

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接