开发者

How can I access certificates installed in a apple OS X

As in Windows, that we have the really old Capicom, that interfaces the CryptoAPI equivalent for us, is there something that he开发者_JAVA技巧lps getting a certificate in a apple system?

If not, is there some way to access them? By bouncy Castle, Itext, java native...

thanks


You can access the KeyChain with the Java KeyStore API as said by @vcsjones. This is some code sample:

KeyStore ks = KeyStore.getInstance("KeychainStore");
ks.load(null);
Enumeration<String> e = ks.aliases();
while (e.hasMoreElements()) {
    String alias = e.nextElement();
    if (ks.isCertificateEntry(alias)) {
        System.out.printf("%s (certificate)\n", alias);
    } else if (ks.isKeyEntry(alias)) {
        System.out.printf("%s (key)\n", alias);
    } else {
        System.out.printf("%s (???)\n", alias);
    }
}


You are probably looking for OSX's keychain. Java has an API which interacts with it using the KeyStore. The method of interest to you is probably getCertificate.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜