Java Jarsigner:找不到证书链
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3255836/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jarsigner: certificate chain not found for
提问by Robert Munteanu
I have imported a certificate into a private ~/.keystore
file:
我已将证书导入到私有~/.keystore
文件中:
keytool -list
Enter keystore password:
Keystore type: JKS
Keystore provider: SUN
Your keystore contains 1 entry
mylyn-mantis, Jul 15, 2010, trustedCertEntry
and am trying to sign a jar with it, but I get a 'certificate chain not found' error.
并试图用它签署一个 jar,但我收到“未找到证书链”错误。
jarsigner -verbose /home/robert/file.jar mylyn-mantis
jarsigner: Certificate chain not found for: mylyn-mantis. mylyn-mantis must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
How can I solve this problem?
我怎么解决这个问题?
采纳答案by Maurice Perry
It seems that your keystore contains only a certificate (public key) you need a complete key entry, with a private key, and the whole certificate chain to be able to sign anything
您的密钥库似乎只包含一个证书(公钥),您需要一个完整的密钥条目、一个私钥和整个证书链才能对任何内容进行签名
回答by Atul
I faced same issue. I am having .p12 file issued by CA and I was trying to sign jar file. However I was getting error:
我遇到了同样的问题。我有 CA 发布的 .p12 文件,我试图签署 jar 文件。但是我收到错误:
jarsigner: Certificate chain not found for:
Basically I was copying alias name from console. It was having wrong character 'question mark' (?) causing this error. Instead I redirected output of keytool
to text file and then I copied alias name from there.
基本上我是从控制台复制别名。它有错误的字符“问号”(?)导致此错误。相反,我将输出重定向keytool
到文本文件,然后从那里复制别名。
Issue this command:
keytool -list -v -storetype pkcs12 -keystore "mycertificate.p12" > cert.txt
发出这个命令:
keytool -list -v -storetype pkcs12 -keystore "mycertificate.p12" > cert.txt
(This is very important. Always redirect to txt file. Do not copy from console output. It can contain wrong characters)
(这很重要。总是重定向到txt文件。不要从控制台输出复制。它可能包含错误的字符)
- Find out alias name in certificate. Open cert.txt and copy string as it is mentioned in front of "Alias name:"
- 在证书中找出别名。打开 cert.txt 并复制“别名:”前面提到的字符串
Let's say this string is "my alias name, a.p.'s my ca limited id"
假设这个字符串是“我的别名,ap 是我的 ca 有限 ID”
Use jarsigner:
jarsigner -storetype pkcs12 -keystore "mycertificate.p12" myjarfile.jar "my alias name, a.p.'s my ca limited id"
使用 jarsigner:
jarsigner -storetype pkcs12 -keystore "mycertificate.p12" myjarfile.jar "我的别名,ap 是我的 ca 有限 ID"