Mac OS X Keychain access in Java for Generic Passwords

前端 未结 5 1045
[愿得一人]
[愿得一人] 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:35

    There is also JNA + Maven project here which doesn't require compiling any native code in the build. Apparently supports OSX and Windows.

    https://bitbucket.org/east301/java-keyring/

    It has less features than osx-keychain-java, but supports Add and Get Generic Password.

    
      net.east301
      java-keyring
      1.0.0
    
    

    Example code

    import net.east301.keyring.Keyring;
    import net.east301.keyring.PasswordRetrievalException;
    
    Keyring keyring = Keyring.create();
    String pw = keyring.getPassword(service, account);
    

提交回复
热议问题