Geertjan's Blog

  • January 24, 2010

NetBeans Keyring API

Geertjan Wielenga
Product Manager
There is a new API in NetBeans 6.9 (Platform and IDE) for storing passwords securely:


If you maintain a module that needs to persist passwords or similar confidential data, use this API rather than relying on ROT-13 obfuscation or the like.

Besides a generic fallback implementation based on a master password (akin to the system in Firefox), there are special implementations unlocked by user login for Gnome ("Passwords and Encryption Keys"); Mac OS X (Keychain); and Windows (custom encrypted storage). If anyone out there is experienced with JNA and/or security APIs and would like to tune one of the implementations, or add support for other platforms (e.g. KWallet), that would be great; just file bug reports blocking


The API has few dependencies on the rest of the NB Platform, so it could be broken out into a library on kenai.com if there is sufficient interest. (Since it seems like a fundamental service, in the long run it would be nice to have something similar in the Java platform.)

The above is copied from an e-mail by Jesse Glick on the dev@platform.netbeans.org mailing list from 12/12/2009.

Join the discussion

Comments ( 11 )
  • Florian Brunner Sunday, January 24, 2010

    This sounds great! :-)

    I just recently wondered if such a thing exists.

    KDE KWallet integration would be great...

  • Abubakar Gurnah Sunday, January 24, 2010

    I get this (You don't have permission to access /dev/javadoc/org-netbeans-modules-keyring/org/netbeans/api/keyring/Keyring.html on this server.) when i try to open (http://bits.netbeans.org/dev/javadoc/org-netbeans-modules-keyring/org/netbeans/api/keyring/Keyring.html)

  • Martin Wildam Monday, January 25, 2010

    @Florian: Then there also should be also integration into the gnome-keyring-manager. And here we are also getting into tight OS-integration which always seems to be a little difficult from within Java. However - sure - that this would be a cool feature.

    @NetBeans developers: You are really doing great work! NetBeans is one of the fastest evolving apps lately as far as I notice.

  • Florian Brunner Monday, January 25, 2010

    @Martin: As far as I could see there is some Gnome integration already:


    But KDE is also very popular on Linux systems.

    Another approach could be to convince the KDE team and Gnome team to implement some common interfaces. This would also make it easier to integrate other desktop environments on Linux - they just would have to implement those interfaces.

  • Jesse Glick Monday, January 25, 2010

    @Florian, @Martin: adding KWallet support would mean studying its APIs and trying to make a binding. The NetBeans SPI is really simple so the work is wrestling with native code. JNA is used for the integration, which definitely makes things easier (e.g. no need to mess around with javah or native compilation), but it can still be tricky to call into C APIs correctly: they can require complicated structs, or have unusual calling conventions. (Fortunately, the Gnome Keyring API provides some easy-to-call convenience methods for the most common tasks; unfortunately, these are not available in older Gnome releases such as is used in Solaris 10.)

  • Jesse Glick Monday, January 25, 2010

    @Abubakar - sorry, there was a bad upload of the production build which caused problems with permissions on Javadoc. Should be fixed now.

  • Jesse Glick Monday, January 25, 2010

    @Florian: there have in fact been attempts in the direction of unifying the two APIs; see <http://lists.freedesktop.org/archives/xdg/2008-August/009820.html>. But until that is implemented and deployed, KDE users need explicit support: <https://netbeans.org/bugzilla/show_bug.cgi?id=179839>

  • Florian Brunner Tuesday, January 26, 2010

    I filed an issue for KDE KWallet support:


    Let's see if this issue can show enough attraction for someone to implement it.

    If you would like to see KDE KWallet support, please vote for it and add a comment (or help implementing it ;-) )

    It even seems there is some work going on to define a common API for Gnome and KDE:


  • psychollek Monday, February 1, 2010

    you say, you gain - one kwallet support on demand (patch tested and submited) :P

  • Jesse Glick Friday, June 18, 2010

    Yes, once the new API starts appearing in official releases of Linux and Solaris distributions it will make sense to support it. The integrations with the GNOME Keyring API and with KWallet (via DBUS) will need to remain for a few years until OS installations not supporting the newer API become scarce.

  • guest Monday, July 6, 2015

    Any updates? I'm looking for a library that supports multiple platforms' keyrings/keychains. Has this functionality been decoupled from Netbeans and published separately, as the original post mentioned?

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.