我有一个自签名根证书,在我的 Mac 钥匙串(keychain)中只有代码签名扩展(没有其他扩展);我使用它对来自 ∞labs 的所有代码进行签名,使用 Apple 的代码设计工具,效果很好。
我希望扩展自己并进行一些 Java 开发。我知道 Apple 提供了一个从钥匙串(keychain)读取的 KeyStore 实现,我可以列出我在“链”中拥有的所有证书:
keytool -list -provider com.apple.crypto.provider.Apple -storetype KeychainStore -keystore NONE -v
但是,每当我尝试使用 jarsigner 来签署一个简单的测试 JAR 文件时,我都会得到:
$ jarsigner -keystore NONE -storetype KeychainStore -providerName Apple a.jar infinitelabs_codesigning_2
Enter Passphrase for keystore: <omitted>
jarsigner: Certificate chain not found for: infinitelabs_codesigning_2. infinitelabs_codesigning_2 must reference a valid KeyStore key entry containing a private key and corresponding public key certificate chain.
我做错了什么?
(证书是在 Apple's instructions for obtaining a signing identity 之后创建的。)
最佳答案
我认为您的 keystore 条目别名一定是错误的。您是否正在使用条目类型为“keyEntry”的 keystore 对象的别名?相同的命令非常适合我。
来自 jarsigner 手册页:
When using jarsigner to sign a JAR file, you must specify the alias for the keystore entry containing the private key needed to generate the signature.
关于java - 如何使用我的 Mac 钥匙串(keychain)中的证书签署 Java 小程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/123902/