|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jdesktop.swingx.auth.KeyChain
public class KeyChain
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.
Constructor Summary | |
---|---|
KeyChain(char[] masterPassword,
InputStream inputStream)
Creates an instance of KeyChain and initializes the store from the InputStream. |
Method Summary | |
---|---|
void |
addPassword(String user,
String server,
char[] password)
Adds a password to the KeyChain for a given account/user and server. |
String |
getPassword(String user,
String server)
Fetches the password for a given account/user and server. |
static void |
main(String[] args)
|
void |
removePassword(String user,
String server)
Removes a password for a given account/user and server. |
void |
store(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 |
---|
public KeyChain(char[] masterPassword, InputStream inputStream) throws IOException
masterPassword
- inputStream
-
IOException
Method Detail |
---|
public String getPassword(String user, String server)
user
- server
-
null
if no password could be obtained, the password
otherwisepublic void addPassword(String user, String server, char[] password)
user
- server
- password
- public void removePassword(String user, String server)
user
- server
- public void store(OutputStream ostream) throws IOException
ostream
-
IOException
public static void main(String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |