org.netbeans.modules.keyring 1.11

org.netbeans.api.keyring
Class Keyring

java.lang.Object
  extended by org.netbeans.api.keyring.Keyring

public class Keyring
extends Object

Client class for working with stored keys (such as passwords).

The key identifier should be unique for the whole application, so qualify it with any prefixes as needed.

Since 1.10 it is allowed to call methods of this class from even dispatch thread.


Method Summary
static void delete(String key)
          Deletes a key from the ring.
static char[] read(String key)
          Reads a key from the ring.
static void save(String key, char[] password, String description)
          Saves a key to the ring.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

read

@CheckForNull
public static char[] read(@NonNull
                                       String key)
Reads a key from the ring.

This method can be called from any thread. All the changes done by previous calls to delete(java.lang.String) or save(java.lang.String, char[], java.lang.String) methods are guaranteed to be visible by subsequent calls to this method.

Parameters:
key - the identifier of the key
Returns:
its value if found (you may null out its elements), else null if not present

save

public static void save(@NonNull
                        String key,
                        @NonNull
                        char[] password,
                        @NullAllowed
                        String description)
Saves a key to the ring. If it could not be saved, does nothing. If the key already existed, overwrites the password.

This method can be called from any thread. The changes done by multiple calls to delete(java.lang.String) or save(java.lang.String, char[], java.lang.String) methods are guaranteed to be processed in order in which they were called.

Parameters:
key - a key identifier
password - the password or other sensitive information associated with the key (its contents will be nulled out by end of call)
description - a user-visible description of the key (may be null)

delete

public static void delete(@NonNull
                          String key)
Deletes a key from the ring. If the key was not in the ring to begin with, does nothing.

This method can be called from any thread. The changes done by multiple calls to delete(java.lang.String) or save(java.lang.String, char[], java.lang.String) methods are guaranteed to be processed in order in which they were called.

Parameters:
key - a key identifier

org.netbeans.modules.keyring 1.11

Built on May 24 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.