本文介绍了使用Java在Mac上存储用户名/密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Java编写一个针对Mac OS X的小程序(推特客户端).作为其功能的一部分,它需要有一个存储推特用户名/​​密码的地方.自然的地方是mac钥匙串,但我找不到任何访问它的方法.

I'm writing a small program (a twitter client) in Java, aimed at Mac OS X. As part of its functionality, it needs to have a place to store the twitter username/password. The natural place would be the mac keychain, but I can't find any way of accessing it.

有没有办法从Java访问mac钥匙串,或者失败了,对于在哪里存储用户名/密码,您有何建议?

Is there any way of accessing the mac keychain from Java, or failing that, what is your recommendation for where to store the username/password instead?

推荐答案

存在Java钥匙串API,因为其中实现了 KeyStore 在OS X .

There is Java keychain API, in that there's an implementation of KeyStore on OS X backed by the keychain.

我认为钥匙串是存储密码的最佳位置(如果不是该位置).它使用好的算法进行了加密,用户可以自由地对应用程序的钥匙串可用性放任自流或偏执,然后密码将与用户存储的所有其他密码一起存储和配置.

I think the keychain is the best place (if not the place) to store the password. It's encrypted with a good algorithm, the user is free to be as permissive or as paranoid over the availability of the keychain to apps as they like, and the password would then be stored with and configured like all of the other passwords the user stores.

这篇关于使用Java在Mac上存储用户名/密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-10 18:26