Modifier and Type | Field and Description |
---|---|
private static String |
DEFAULT_TYPE
Default keystore type.
|
Modifier | Constructor and Description |
---|---|
private |
KeyStoreUtils()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static KeyStore.Entry |
getEntry(String alias,
KeyStore keystore,
char[] password)
Returns a keystore entry from the supplied keystore.
|
static KeyStore |
newInstance()
Creates a new
KeyStore with the default keystore type and initializes it. |
static KeyStore |
newInstance(char[] password)
Creates a new
KeyStore with the default keystore type and initializes it. |
static KeyStore |
newInstance(String type)
Creates a new
KeyStore and initializes it. |
static KeyStore |
newInstance(String type,
char[] password)
Creates a new
KeyStore and initializes it. |
static void |
setCertificateEntry(String alias,
KeyStore keystore,
Certificate... certs)
Sets certificate entries on the supplied keystore.
|
static void |
setEntry(String alias,
KeyStore.Entry entry,
KeyStore keystore,
char[] password)
Sets a keystore entry on the supplied keystore.
|
static void |
setKeyEntry(String alias,
KeyStore keystore,
char[] password,
Key key,
Certificate... certs)
Sets a key entry on the supplied keystore.
|
private static final String DEFAULT_TYPE
public static KeyStore newInstance() throws GeneralSecurityException
KeyStore
with the default keystore type and initializes it.GeneralSecurityException
- if the keystore cannot be initializedpublic static KeyStore newInstance(char[] password) throws GeneralSecurityException
KeyStore
with the default keystore type and initializes it.password
- to protect the keystoreGeneralSecurityException
- if the keystore cannot be initializedpublic static KeyStore newInstance(String type) throws GeneralSecurityException
KeyStore
and initializes it.type
- of keystore instanceGeneralSecurityException
- if the keystore cannot be initializedpublic static KeyStore newInstance(String type, char[] password) throws GeneralSecurityException
KeyStore
and initializes it.type
- of keystore instancepassword
- to protect the keystoreGeneralSecurityException
- if the keystore cannot be initializedpublic static KeyStore.Entry getEntry(String alias, KeyStore keystore, char[] password) throws GeneralSecurityException
alias
- of the entry to returnkeystore
- to read the entry frompassword
- to access the keystoreGeneralSecurityException
- if the keystore cannot be readIllegalArgumentException
- if the alias does not existpublic static void setEntry(String alias, KeyStore.Entry entry, KeyStore keystore, char[] password) throws GeneralSecurityException
alias
- of the supplied entryentry
- to setkeystore
- to set the entry onpassword
- to protect the entryGeneralSecurityException
- if the keystore cannot be modifiedpublic static void setKeyEntry(String alias, KeyStore keystore, char[] password, Key key, Certificate... certs) throws GeneralSecurityException
alias
- of the supplied keykeystore
- to set the key onpassword
- to protect the keykey
- to setcerts
- associated with the keyGeneralSecurityException
- if the keystore cannot be modifiedpublic static void setCertificateEntry(String alias, KeyStore keystore, Certificate... certs) throws GeneralSecurityException
alias
- of the supplied certificate(s)keystore
- to set the cert(s) oncerts
- to setGeneralSecurityException
- if the keystore cannot be modifiedCopyright © 2003-2019 Virginia Tech. All Rights Reserved.