Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jdesktop.swingx.auth
Class KeyChain

    java.lang.Object
      org.jdesktop.swingx.auth.KeyChain

    public class KeyChain

extends java.lang.Object

KeyChain is a class that implements the "KeyChain" concept. Fundamentally, it allows you to store multiple keys/credentials in a central password store. Access to this central store is controlled through a master password. This mechanism is used in many popular client applications where you need to store credentials for multiple servers/accounts. The actual store for the KeyStore can be any OutputStream and it can work in the webstart sandbox using Muffins.

To contstruct a KeyChain, you need to pass in an InputStream to the store and it will initialize the KeyStore from the InputStream. You can add and remove entries any time once you have an instance of KeyChain. To persist the KeyChain and reflect any changes, you need to call store method with an OutputStream.

Author:
  Bino George

Constructor Summary
`KeyChain(char[] masterPassword, java.io.InputStream inputStream)` Creates an instance of KeyChain and initializes the store from the InputStream.

Method Summary
`void` | `addPassword(java.lang.String user, java.lang.String server, char[] password)` Adds a password to the KeyChain for a given account/user and server.
`java.lang.String` | `getPassword(java.lang.String user, java.lang.String server)` Fetches the password for a given account/user and server.
`static void` | `main(java.lang.String[] args)`
`void` | `removePassword(java.lang.String user, java.lang.String server)` Removes a password for a given account/user and server.
`void` | `store(java.io.OutputStream ostream)` Persists the KeyChain to an OutputStream

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### KeyChain

    public KeyChain(char[] masterPassword,
                    java.io.InputStream inputStream)
             throws java.io.IOException

  Creates an instance of KeyChain and initializes the store from the InputStream.

  Parameters:
    `masterPassword` -
    `inputStream` -
  Throws:
    `java.io.IOException`

Method Detail

### getPassword

    public java.lang.String getPassword(java.lang.String user,
                                        java.lang.String server)

  Fetches the password for a given account/user and server.

  Parameters:
    `user` -
    `server` -
  Returns:
    `null` if no password could be obtained, the password otherwise

### addPassword

    public void addPassword(java.lang.String user,
                            java.lang.String server,
                            char[] password)

  Adds a password to the KeyChain for a given account/user and server.

  Parameters:
    `user` -
    `server` -
    `password` -

### removePassword

    public void removePassword(java.lang.String user,
                               java.lang.String server)

  Removes a password for a given account/user and server.

  Parameters:
    `user` -
    `server` -

### store

    public void store(java.io.OutputStream ostream)
               throws java.io.IOException

  Persists the KeyChain to an OutputStream

  Parameters:
    `ostream` -
  Throws:
    `java.io.IOException`

### main

    public static void main(java.lang.String[] args)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010. All Rights Reserved.