Package org.ldaptive.ssl
Class KeyStoreUtils
- java.lang.Object
- 
- org.ldaptive.ssl.KeyStoreUtils
 
- 
- 
Field SummaryFields Modifier and Type Field Description private static StringDEFAULT_TYPEDefault keystore type.
 - 
Constructor SummaryConstructors Modifier Constructor Description privateKeyStoreUtils()Default constructor.
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static KeyStore.EntrygetEntry(String alias, KeyStore keystore, char[] password)Returns a keystore entry from the supplied keystore.static KeyStorenewInstance()Creates a newKeyStorewith the default keystore type and initializes it.static KeyStorenewInstance(char[] password)Creates a newKeyStorewith the default keystore type and initializes it.static KeyStorenewInstance(String type)Creates a newKeyStoreand initializes it.static KeyStorenewInstance(String type, char[] password)Creates a newKeyStoreand initializes it.static voidsetCertificateEntry(String alias, KeyStore keystore, Certificate... certs)Sets certificate entries on the supplied keystore.static voidsetEntry(String alias, KeyStore.Entry entry, KeyStore keystore, char[] password)Sets a keystore entry on the supplied keystore.static voidsetKeyEntry(String alias, KeyStore keystore, char[] password, Key key, Certificate... certs)Sets a key entry on the supplied keystore.
 
- 
- 
- 
Field Detail- 
DEFAULT_TYPEprivate static final String DEFAULT_TYPE Default keystore type.
 
- 
 - 
Method Detail- 
newInstancepublic static KeyStore newInstance() throws GeneralSecurityException Creates a newKeyStorewith the default keystore type and initializes it.- Returns:
- initialized keystore
- Throws:
- GeneralSecurityException- if the keystore cannot be initialized
 
 - 
newInstancepublic static KeyStore newInstance(char[] password) throws GeneralSecurityException Creates a newKeyStorewith the default keystore type and initializes it.- Parameters:
- password- to protect the keystore
- Returns:
- initialized keystore
- Throws:
- GeneralSecurityException- if the keystore cannot be initialized
 
 - 
newInstancepublic static KeyStore newInstance(String type) throws GeneralSecurityException Creates a newKeyStoreand initializes it.- Parameters:
- type- of keystore instance
- Returns:
- initialized keystore
- Throws:
- GeneralSecurityException- if the keystore cannot be initialized
 
 - 
newInstancepublic static KeyStore newInstance(String type, char[] password) throws GeneralSecurityException Creates a newKeyStoreand initializes it.- Parameters:
- type- of keystore instance
- password- to protect the keystore
- Returns:
- initialized keystore
- Throws:
- GeneralSecurityException- if the keystore cannot be initialized
 
 - 
getEntrypublic static KeyStore.Entry getEntry(String alias, KeyStore keystore, char[] password) throws GeneralSecurityException Returns a keystore entry from the supplied keystore.- Parameters:
- alias- of the entry to return
- keystore- to read the entry from
- password- to access the keystore
- Returns:
- keystore entry
- Throws:
- GeneralSecurityException- if the keystore cannot be read
- IllegalArgumentException- if the alias does not exist
 
 - 
setEntrypublic static void setEntry(String alias, KeyStore.Entry entry, KeyStore keystore, char[] password) throws GeneralSecurityException Sets a keystore entry on the supplied keystore.- Parameters:
- alias- of the supplied entry
- entry- to set
- keystore- to set the entry on
- password- to protect the entry
- Throws:
- GeneralSecurityException- if the keystore cannot be modified
 
 - 
setKeyEntrypublic static void setKeyEntry(String alias, KeyStore keystore, char[] password, Key key, Certificate... certs) throws GeneralSecurityException Sets a key entry on the supplied keystore.- Parameters:
- alias- of the supplied key
- keystore- to set the key on
- password- to protect the key
- key- to set
- certs- associated with the key
- Throws:
- GeneralSecurityException- if the keystore cannot be modified
 
 - 
setCertificateEntrypublic static void setCertificateEntry(String alias, KeyStore keystore, Certificate... certs) throws GeneralSecurityException Sets certificate entries on the supplied keystore. For certificate arrays of size greater than 1, the alias is appended with an index.- Parameters:
- alias- of the supplied certificate(s)
- keystore- to set the cert(s) on
- certs- to set
- Throws:
- GeneralSecurityException- if the keystore cannot be modified
 
 
- 
 
-