|
||||||||||
| 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 java.lang.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(java.lang.String keyStoreFileName,
char[] masterPassword)
Construct a PasswordAdapter with given Shared Master Password, SMP. |
|
| Method Summary | |
|---|---|
boolean |
aliasExists(java.lang.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,
java.lang.String algorithm)
|
java.util.Enumeration<java.lang.String> |
getAliases()
Return the aliases from the keystore. |
java.lang.String |
getPasswordForAlias(java.lang.String alias)
This methods returns password String for a given alias and SMP. |
javax.crypto.SecretKey |
getPasswordSecretKeyForAlias(java.lang.String alias)
This methods returns password SecretKey for a given alias and SMP. |
void |
removeAlias(java.lang.String alias)
Remove an alias from the keystore |
void |
setPasswordForAlias(java.lang.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 java.lang.String PASSWORD_ALIAS_KEYSTORE
| Constructor Detail |
|---|
public PasswordAdapter(char[] masterPassword)
throws java.security.cert.CertificateException,
java.io.IOException,
java.security.KeyStoreException,
java.security.NoSuchAlgorithmException
smp - master password
java.security.cert.CertificateException
java.io.IOException
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
public PasswordAdapter(java.lang.String keyStoreFileName,
char[] masterPassword)
throws java.security.cert.CertificateException,
java.io.IOException,
java.security.KeyStoreException,
java.security.NoSuchAlgorithmException
keyfileName - the jceks key file namesmp - master password
java.security.cert.CertificateException
java.io.IOException
java.security.KeyStoreException
java.security.NoSuchAlgorithmException| Method Detail |
|---|
public java.lang.String getPasswordForAlias(java.lang.String alias)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.UnrecoverableKeyException
alias -
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.UnrecoverableKeyException
public javax.crypto.SecretKey getPasswordSecretKeyForAlias(java.lang.String alias)
throws java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.UnrecoverableKeyException
alias -
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.UnrecoverableKeyException
public boolean aliasExists(java.lang.String alias)
throws java.security.KeyStoreException
alias - the alias name
java.security.KeyStoreException
public void removeAlias(java.lang.String alias)
throws java.security.KeyStoreException,
java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.security.UnrecoverableKeyException
alias - The name of the alias to remove
java.security.KeyStoreException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.security.UnrecoverableKeyException
public java.util.Enumeration<java.lang.String> getAliases()
throws java.security.KeyStoreException
java.security.KeyStoreException
public void writeStore()
throws java.security.KeyStoreException,
java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.security.UnrecoverableKeyException
java.security.KeyStoreException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.security.UnrecoverableKeyException
public void setPasswordForAlias(java.lang.String alias,
byte[] keyBytes)
throws java.security.cert.CertificateException,
java.io.IOException,
java.security.KeyStoreException,
java.security.NoSuchAlgorithmException,
java.security.UnrecoverableKeyException
alias - secretKey -
java.security.cert.CertificateException
java.io.IOException
java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.UnrecoverableKeyException
public void changePassword(char[] newMasterPassword)
throws java.security.KeyStoreException,
java.io.IOException,
java.security.NoSuchAlgorithmException,
java.security.cert.CertificateException,
java.security.UnrecoverableKeyException
There are several error conditions that could occur:
newpassword - the new keystore password
java.security.KeyStoreException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.security.UnrecoverableKeyException
public byte[] decrypt(byte[] encrypted,
java.lang.String algorithm)
throws java.security.NoSuchAlgorithmException,
java.io.IOException,
javax.crypto.NoSuchPaddingException,
java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
java.security.NoSuchAlgorithmException
java.io.IOException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
javax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||