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 |
---|---|
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() |
String |
getKeyStoreFilename() |
char[] |
getKeyStorePassword() |
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 void initKeyStore(String keystoreFilename, String keystorePasswd, String keyPasswordNew) throws CryptoException
keystoreFilename
- keystorePasswd
- keyPasswordNew
- CryptoException
public boolean deleteKeyFromKeyStore(String alias)
alias
- public boolean setKeytoKeyStore(String alias, Key key, Certificate[] chain)
alias
- key
- chain
- public boolean saveKeyStore(String filename)
filename
- public void initTrustStore(String truststoreFilename, String truststorePasswd, boolean needClientAuthent) throws CryptoException
truststoreFilename
- truststorePasswd
- needClientAuthent
- True if the TrustStore is also to
authenticate
clientsCryptoException
public boolean initEmptyTrustStore()
public boolean deleteKeyFromTrustStore(String alias)
alias
- public boolean setKeytoTrustStore(String alias, Certificate cert)
alias
- cert
- public boolean saveTrustStore(String filename)
filename
- public static Certificate loadX509Certificate(String filename) throws CertificateException, FileNotFoundException
filename
- CertificateException
FileNotFoundException
public char[] getCertificatePassword()
public char[] getKeyStorePassword()
public char[] getKeyTrustStorePassword()
public String getKeyStoreFilename()
public WaarpSecureTrustManagerFactory getSecureTrustManagerFactory()
public KeyManagerFactory getKeyManagerFactory()
Copyright © 2009–2020 Waarp. All rights reserved.