public class WaarpSecureKeyStore extends Object
Constructor and Description |
---|
WaarpSecureKeyStore(String keyStorePasswd,
String keyPassword)
Initialize empty KeyStore.
|
WaarpSecureKeyStore(String keyStoreFilename,
String keyStorePasswd,
String keyPassword)
Initialize the SecureKeyStore with no TrustStore from file
|
WaarpSecureKeyStore(String keyStoreFilename,
String keyStorePasswd,
String keyPassword,
String trustStoreFilename,
String trustStorePasswd,
boolean needClientAuthent)
Initialize the SecureKeyStore and TrustStore from files
|
Modifier and Type | Method and Description |
---|---|
static boolean |
checkExpiryDate(KeyStore keystore) |
boolean |
deleteKeyFromKeyStore(String alias)
Delete a Key from the KeyStore based on its alias
|
boolean |
deleteKeyFromTrustStore(String alias)
Delete a Key from the TrustStore based on its alias
|
char[] |
getCertificatePassword() |
KeyManagerFactory |
getKeyManagerFactory() |
KeyStore |
getKeyStore() |
String |
getKeyStoreFilename() |
char[] |
getKeyStorePassword() |
KeyStore |
getKeyTrustStore() |
char[] |
getKeyTrustStorePassword() |
WaarpSecureTrustManagerFactory |
getSecureTrustManagerFactory() |
boolean |
initEmptyTrustStore()
Initialize an empty TrustStore
|
void |
initKeyStore(String keystoreFilename,
String keystorePasswd,
String keyPasswordNew)
Initialize the SecureKeyStore with no TrustStore from file
|
void |
initTrustStore(String truststoreFilename,
String truststorePasswd,
boolean needClientAuthent)
Initialize the TrustStore from a filename and its password
|
static Certificate |
loadX509Certificate(String filename)
Load a certificate from a filename
|
boolean |
saveKeyStore(String filename)
Save a KeyStore to a file
|
boolean |
saveTrustStore(String filename)
Save the TrustStore to a file
|
boolean |
setKeytoKeyStore(String alias,
Key key,
Certificate[] chain)
Add a Key and its certificates into the KeyStore based on its alias
|
boolean |
setKeytoTrustStore(String alias,
Certificate cert)
Add a Certificate into the TrustStore based on its alias
|
public WaarpSecureKeyStore(String keyStorePasswd, String keyPassword) throws CryptoException
keyStorePasswd
- keyPassword
- CryptoException
public WaarpSecureKeyStore(String keyStoreFilename, String keyStorePasswd, String keyPassword) throws CryptoException
keyStoreFilename
- keyStorePasswd
- keyPassword
- CryptoException
public WaarpSecureKeyStore(String keyStoreFilename, String keyStorePasswd, String keyPassword, String trustStoreFilename, String trustStorePasswd, boolean needClientAuthent) throws CryptoException
keyStoreFilename
- keyStorePasswd
- keyPassword
- trustStoreFilename
- if Null, no TrustKeyStore will be
createdtrustStorePasswd
- needClientAuthent
- True if the TrustStore is also used for
Client
AuthenticationCryptoException
public final void initKeyStore(String keystoreFilename, String keystorePasswd, String keyPasswordNew) throws CryptoException
keystoreFilename
- keystorePasswd
- keyPasswordNew
- CryptoException
public final boolean deleteKeyFromKeyStore(String alias)
alias
- public final boolean setKeytoKeyStore(String alias, Key key, Certificate[] chain)
alias
- key
- chain
- public final boolean saveKeyStore(String filename)
filename
- public final void initTrustStore(String truststoreFilename, String truststorePasswd, boolean needClientAuthent) throws CryptoException
truststoreFilename
- truststorePasswd
- needClientAuthent
- True if the TrustStore is also to
authenticate
clientsCryptoException
public final boolean initEmptyTrustStore()
public final boolean deleteKeyFromTrustStore(String alias)
alias
- public final boolean setKeytoTrustStore(String alias, Certificate cert)
alias
- cert
- public final boolean saveTrustStore(String filename)
filename
- public static Certificate loadX509Certificate(String filename) throws CertificateException, FileNotFoundException
filename
- CertificateException
FileNotFoundException
public final char[] getCertificatePassword()
public final char[] getKeyStorePassword()
public final char[] getKeyTrustStorePassword()
public final String getKeyStoreFilename()
public final WaarpSecureTrustManagerFactory getSecureTrustManagerFactory()
public final KeyManagerFactory getKeyManagerFactory()
public final KeyStore getKeyStore()
public final KeyStore getKeyTrustStore()
public static boolean checkExpiryDate(KeyStore keystore)
keystore
- Copyright © 2009–2022 Waarp. All rights reserved.