java - 如何使用我的 Mac 钥匙串(keychain)中的证书签署 Java 小程序?

标签 java macos certificate signing keychain

我有一个自签名根证书,在我的 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/

相关文章:

ruby - OS X Yosemite ffi-hunspell dyld 惰性符号绑定(bind)失败 : symbol not found

azure - Azure 应用服务无法从 wwwroot 文件系统加载 pfx 证书

python - 为什么在 Mac 上键入括号时 Python 的 IDLE 会崩溃?

java - 如何利用redis提供的数据ID快速查询Oracle中的数据

java - 面向对象访问说明符背后的推理

java - EAR lib 的类为 WAR 成员抛出 ClassNotFoundException

macos - VIM:有 ('macunix' ) 或有 ('mac' ) 不起作用

validation - 证书异常 Websphere 应用程序

security - 为什么在生产中使用使用 MakeCert 工具制作的证书不好?

java - 文档在 Javadoc 中不可见