Mac OS X Keychain access in Java for Generic Passwords

前端 未结 5 1020
[愿得一人]
[愿得一人] 2020-12-30 15:51

What is the standard way to retrieve generic passwords in the Keychain of OS X using only Java? Apple Developer Pages provide some good background but the implementation and

5条回答
  •  一生所求
    2020-12-30 16:33

    I am now using https://github.com/davidafsilva/jkeychain which is a fork of conormcd/osx-keychain-java

    Gradle

    compile 'pt.davidafsilva.apple:jkeychain:1.0.0'
    

    Example

    final OSXKeychain keychain = OSXKeychain.getInstance();
    final Optional mySecret = keychain.findGenericPassword("mySecret", "username");
    

    Example project usage: https://github.com/yschimke/okurl/blob/b3208514b4338a2f57bfedccb2da4e6f54d0d99a/src/main/kotlin/com/baulsupp/okurl/credentials/OSXCredentialsStore.kt

提交回复
热议问题