public class SecurityManager extends Object
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_CERT_FILE |
static String |
DEFAULT_KEY_FILE |
static String |
DEFAULT_TRUST_DIR |
static String |
DEFAULT_TRUST_FILE_EXTENSION |
static String |
KEYSTORE_PWD |
| Modifier and Type | Method and Description |
|---|---|
void |
addTrustedCert(String file)
Adds a single trusted certificate
|
String |
getCertFile() |
static SecurityManager |
getInstance() |
String |
getKeyFile() |
KeyStore |
getKeyStore() |
String |
getTrustDir() |
void |
invalidateTrustedDir(boolean invalidate)
If true is passed, the trust dir won't be taken into account
|
void |
loadCertificate()
Loads the configured certificates
|
void |
loadCertificate(boolean threadLocal) |
static void |
main(String[] args) |
void |
removeCertificate()
Removes the current credentials from the SSL Socket factory restoring what were set in the ancestor threads
|
void |
setCertFile(String certFile)
Sets the certificate
|
void |
setKeyFile(String keyFile)
Sets the key file
|
void |
setPrivateKeyPassword(char[] password) |
void |
setTrustDir(String trustDir)
Sets the trust directory
|
void |
setTrustExt(String trustExt)
The trust extension
|
public static final String KEYSTORE_PWD
public static final String DEFAULT_CERT_FILE
public static final String DEFAULT_KEY_FILE
public static final String DEFAULT_TRUST_DIR
public static final String DEFAULT_TRUST_FILE_EXTENSION
public static SecurityManager getInstance()
public void setCertFile(String certFile)
certFile - the complete path to the certificate PEM filepublic void setPrivateKeyPassword(char[] password)
public void setKeyFile(String keyFile)
keyFile - the complete path to the key PEM filepublic void setTrustDir(String trustDir)
trustDir - the path to the trust dirpublic void setTrustExt(String trustExt)
trustExt - the trust files extensionpublic String getCertFile()
public String getKeyFile()
public String getTrustDir()
public void invalidateTrustedDir(boolean invalidate)
invalidate - public void addTrustedCert(String file)
file - the complete path to the trusted certificate PEM filepublic void loadCertificate()
throws Exception
Exceptionpublic void loadCertificate(boolean threadLocal)
throws Exception
threadLocal - Exceptionpublic void removeCertificate()
public KeyStore getKeyStore()
Copyright © 2017. All Rights Reserved.