public class TlsContext
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
CERT_EXTENSIONS
Default cert file extensions
|
static char[] |
DEFAULT_PASSWORD
Default password
|
Constructor and Description |
---|
TlsContext()
Creates a new TlsContext.
|
TlsContext(char[] passwd)
Creates a new TlsContext.
|
Modifier and Type | Method and Description |
---|---|
void |
addTrustCert(java.security.cert.Certificate cert)
Adds a trusted certificate.
|
void |
addTrustCert(java.lang.String cert_file)
Adds a trusted certificate.
|
void |
addTrustFolder(java.lang.String cert_folder)
Adds all trusted certificates from the specified folder.
|
java.security.KeyStore |
getKeyStore()
Gets KeyStore.
|
boolean |
isTrustAll()
Wheather it's in trust-all mode.
|
void |
setKeyCert(java.security.Key key,
java.security.cert.Certificate cert)
Sets key certificate.
|
void |
setKeyCert(java.lang.String key_file,
java.lang.String cert_file)
Sets key certificate.
|
void |
setTrustAll(boolean trust_all)
Sets trust-all mode.
|
public static final java.lang.String[] CERT_EXTENSIONS
public static final char[] DEFAULT_PASSWORD
public TlsContext() throws java.security.KeyStoreException, java.security.cert.CertificateException, java.security.NoSuchAlgorithmException, java.io.IOException
java.security.KeyStoreException
java.security.cert.CertificateException
java.security.NoSuchAlgorithmException
java.io.IOException
public TlsContext(char[] passwd) throws java.security.KeyStoreException, java.security.cert.CertificateException, java.security.NoSuchAlgorithmException, java.io.IOException
java.security.KeyStoreException
java.security.cert.CertificateException
java.security.NoSuchAlgorithmException
java.io.IOException
public void setKeyCert(java.lang.String key_file, java.lang.String cert_file) throws java.security.cert.CertificateException, java.io.FileNotFoundException, java.security.KeyStoreException, java.lang.Exception
java.security.cert.CertificateException
java.io.FileNotFoundException
java.security.KeyStoreException
java.lang.Exception
public void setKeyCert(java.security.Key key, java.security.cert.Certificate cert) throws java.security.KeyStoreException
java.security.KeyStoreException
public void addTrustCert(java.lang.String cert_file) throws java.security.cert.CertificateException, java.io.FileNotFoundException, java.security.KeyStoreException
java.security.cert.CertificateException
java.io.FileNotFoundException
java.security.KeyStoreException
public void addTrustCert(java.security.cert.Certificate cert) throws java.security.KeyStoreException
java.security.KeyStoreException
public void addTrustFolder(java.lang.String cert_folder) throws java.security.cert.CertificateException, java.io.FileNotFoundException, java.security.KeyStoreException
java.security.cert.CertificateException
java.io.FileNotFoundException
java.security.KeyStoreException
public void setTrustAll(boolean trust_all)
public boolean isTrustAll()
public java.security.KeyStore getKeyStore()