public final class PasswordAdapter extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
PASSWORD_ALIAS_KEYSTORE |
| Constructor and Description |
|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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
|
public static final String PASSWORD_ALIAS_KEYSTORE
public PasswordAdapter(char[] masterPassword)
throws CertificateException,
IOException,
KeyStoreException,
NoSuchAlgorithmException
smp - master passwordCertificateExceptionIOExceptionKeyStoreExceptionNoSuchAlgorithmExceptionpublic PasswordAdapter(String keyStoreFileName, char[] masterPassword) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException
keyfileName - the jceks key file namesmp - master passwordCertificateExceptionIOExceptionKeyStoreExceptionNoSuchAlgorithmExceptionpublic String getPasswordForAlias(String alias) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException
alias - KeyStoreExceptionNoSuchAlgorithmExceptionUnrecoverableKeyExceptionpublic SecretKey getPasswordSecretKeyForAlias(String alias) throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException
alias - KeyStoreExceptionNoSuchAlgorithmExceptionUnrecoverableKeyExceptionpublic boolean aliasExists(String alias) throws KeyStoreException
alias - the alias nameKeyStoreExceptionpublic void removeAlias(String alias) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException
alias - The name of the alias to removeKeyStoreExceptionIOExceptionNoSuchAlgorithmExceptionCertificateExceptionUnrecoverableKeyExceptionpublic Enumeration<String> getAliases() throws KeyStoreException
KeyStoreExceptionpublic void writeStore()
throws KeyStoreException,
IOException,
NoSuchAlgorithmException,
CertificateException,
UnrecoverableKeyException
public void setPasswordForAlias(String alias, byte[] keyBytes) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException
alias - secretKey - CertificateExceptionIOExceptionKeyStoreExceptionNoSuchAlgorithmExceptionUnrecoverableKeyExceptionpublic void changePassword(char[] newMasterPassword)
throws KeyStoreException,
IOException,
NoSuchAlgorithmException,
CertificateException,
UnrecoverableKeyException
There are several error conditions that could occur:
newpassword - the new keystore passwordKeyStoreExceptionIOExceptionNoSuchAlgorithmExceptionCertificateExceptionUnrecoverableKeyExceptionCopyright © 2017–2020 Eclipse Foundation. All rights reserved.