|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.enterprise.security.store.PasswordAdapter
public final class PasswordAdapter
This class implements an adapter for password manipulation a JCEKS. Note that although it uses locks ('synchronized'), it tends to be created anew with each use, an inefficient and potentially problematic use that could create more than one instance accessing the same keystore at a time.
| Field Summary | |
|---|---|
static String |
PASSWORD_ALIAS_KEYSTORE
|
| Constructor Summary | |
|---|---|
PasswordAdapter(char[] masterPassword)
Construct a PasswordAdapter with given Shared Master Password, SMP using the default keyfile (domain-passwords.jceks) |
|
PasswordAdapter(String keyStoreFileName,
char[] masterPassword)
Construct a PasswordAdapter with given Shared Master Password, SMP. |
|
| Method Summary | |
|---|---|
boolean |
aliasExists(String alias)
See if the given alias exists |
void |
changePassword(char[] newMasterPassword)
Changes the keystore password, including the encoding of the keys within it. |
byte[] |
decrypt(byte[] encrypted,
String algorithm)
|
Enumeration<String> |
getAliases()
Return the aliases from the keystore. |
String |
getPasswordForAlias(String alias)
This methods returns password String for a given alias and SMP. |
SecretKey |
getPasswordSecretKeyForAlias(String alias)
This methods returns password SecretKey for a given alias and SMP. |
void |
removeAlias(String alias)
Remove an alias from the keystore |
void |
setPasswordForAlias(String alias,
byte[] keyBytes)
This methods set alias, secretKey into JCEKS keystore. |
void |
writeStore()
Writes the keystore to disk |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String PASSWORD_ALIAS_KEYSTORE
| Constructor Detail |
|---|
public PasswordAdapter(char[] masterPassword)
throws CertificateException,
IOException,
KeyStoreException,
NoSuchAlgorithmException
smp - master password
CertificateException
IOException
KeyStoreException
NoSuchAlgorithmException
public PasswordAdapter(String keyStoreFileName,
char[] masterPassword)
throws CertificateException,
IOException,
KeyStoreException,
NoSuchAlgorithmException
keyfileName - the jceks key file namesmp - master password
CertificateException
IOException
KeyStoreException
NoSuchAlgorithmException| Method Detail |
|---|
public String getPasswordForAlias(String alias)
throws KeyStoreException,
NoSuchAlgorithmException,
UnrecoverableKeyException
alias -
KeyStoreException
NoSuchAlgorithmException
UnrecoverableKeyException
public SecretKey getPasswordSecretKeyForAlias(String alias)
throws KeyStoreException,
NoSuchAlgorithmException,
UnrecoverableKeyException
alias -
KeyStoreException
NoSuchAlgorithmException
UnrecoverableKeyException
public boolean aliasExists(String alias)
throws KeyStoreException
alias - the alias name
KeyStoreException
public void removeAlias(String alias)
throws KeyStoreException,
IOException,
NoSuchAlgorithmException,
CertificateException,
UnrecoverableKeyException
alias - The name of the alias to remove
KeyStoreException
IOException
NoSuchAlgorithmException
CertificateException
UnrecoverableKeyException
public Enumeration<String> getAliases()
throws KeyStoreException
KeyStoreException
public void writeStore()
throws KeyStoreException,
IOException,
NoSuchAlgorithmException,
CertificateException,
UnrecoverableKeyException
KeyStoreException
IOException
NoSuchAlgorithmException
CertificateException
UnrecoverableKeyException
public void setPasswordForAlias(String alias,
byte[] keyBytes)
throws CertificateException,
IOException,
KeyStoreException,
NoSuchAlgorithmException,
UnrecoverableKeyException
alias - secretKey -
CertificateException
IOException
KeyStoreException
NoSuchAlgorithmException
UnrecoverableKeyException
public void changePassword(char[] newMasterPassword)
throws KeyStoreException,
IOException,
NoSuchAlgorithmException,
CertificateException,
UnrecoverableKeyException
There are several error conditions that could occur:
newpassword - the new keystore password
KeyStoreException
IOException
NoSuchAlgorithmException
CertificateException
UnrecoverableKeyException
public byte[] decrypt(byte[] encrypted,
String algorithm)
throws NoSuchAlgorithmException,
IOException,
NoSuchPaddingException,
InvalidKeyException,
InvalidAlgorithmParameterException,
IllegalBlockSizeException,
BadPaddingException
NoSuchAlgorithmException
IOException
NoSuchPaddingException
InvalidKeyException
InvalidAlgorithmParameterException
IllegalBlockSizeException
BadPaddingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||