public class TLSUtils
extends java.lang.Object
Constructor and Description |
---|
TLSUtils() |
Modifier and Type | Method and Description |
---|---|
static javax.net.ssl.SSLContext |
createSSLContext(byte[] truststore,
java.lang.String password)
Create an SSL context from the truststore and specified password
Use PKS12 and TLS
|
static javax.net.ssl.SSLContext |
createSSLContext(java.lang.String truststoreType,
java.lang.String credentialType)
Pull truststore and credentials from internal storage
Create an SSL Context for the truststore
|
static javax.net.ssl.SSLContext |
createSSLContext(TrustStore truststore)
Create an SSL context from the Truststore
|
static org.apache.http.conn.ssl.SSLSocketFactory |
createSSLSocketFactory(byte[] truststore,
java.lang.String password)
Create an SSL context from the truststore and specified password
|
static org.apache.http.conn.ssl.SSLSocketFactory |
createSSLSocketFactory(java.lang.String truststoreType,
java.lang.String credentialType)
Pull truststore and credentials from internal storage
Create an SSL Socket Factory for the truststore
|
static org.apache.http.conn.ssl.SSLSocketFactory |
createSSLSocketFactory(TrustStore truststore)
Create an SSL context from the Truststore
|
static AtakAuthenticationCredentials |
getCredentials(java.lang.String server,
boolean bUseDefault)
Get TAK Server credentials (TYPE_COT_SERVICE) for specified server host
Optionally, use default credentials
|
static AtakAuthenticationCredentials |
getDefaultCredentials(boolean bFirstAvailable)
Get default TAK Server credentials (TYPE_COT_SERVICE)
Optionally, get first available (if default not set)
|
static TrustStore |
getDefaultTruststore(boolean bFirstAvailable)
Get default TAK Server truststore
Optionally, get first available (if default not set)
|
static java.util.List<CotPortListActivity.CotPort> |
getServersWithCredentials(boolean bRequireUseAuth)
Get list of TAK Server connections which have User Authentication credentials
available.
|
static TrustStore |
getTruststore(java.lang.String server,
boolean bUseDefault)
Get TAK Server truststore for specified server host
Optionally, use default truststore
|
static TrustStore |
getTruststoreForType(java.lang.String truststoreType,
java.lang.String credentialType)
Helper method to get Truststore and credentials
|
static void |
promptCertificateError(android.content.Context context,
java.lang.String host,
java.lang.String message,
boolean interactive) |
static AtakCertificateDatabase.CertificateValidity |
validateCert(java.lang.String hostname)
Validate client cert stored for specified connection
|
static AtakCertificateDatabase.CertificateValidity |
validateCert(java.lang.String hostname,
int port)
Validate client cert stored for specified connection
|
public static TrustStore getTruststore(java.lang.String server, boolean bUseDefault)
server
- if empty, then use default truststorebUseDefault
- if true, then use default if truststore not found for specified serverpublic static TrustStore getTruststoreForType(java.lang.String truststoreType, java.lang.String credentialType)
truststoreType
- the truststore typecredentialType
- the credential typepublic static TrustStore getDefaultTruststore(boolean bFirstAvailable)
public static AtakAuthenticationCredentials getDefaultCredentials(boolean bFirstAvailable)
public static AtakAuthenticationCredentials getCredentials(java.lang.String server, boolean bUseDefault)
server
- if empty, then use default credentialsbUseDefault
- if true, then use default if credentials not found for specified serverpublic static java.util.List<CotPortListActivity.CotPort> getServersWithCredentials(boolean bRequireUseAuth)
public static javax.net.ssl.SSLContext createSSLContext(java.lang.String truststoreType, java.lang.String credentialType) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.io.IOException, java.security.cert.CertificateException
truststoreType
- the truststore typecredentialType
- the credential typejava.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException
public static javax.net.ssl.SSLContext createSSLContext(TrustStore truststore) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.io.IOException, java.security.cert.CertificateException
truststore
- java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException
public static javax.net.ssl.SSLContext createSSLContext(byte[] truststore, java.lang.String password) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.io.IOException, java.security.cert.CertificateException
truststore
- password
- java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException
public static org.apache.http.conn.ssl.SSLSocketFactory createSSLSocketFactory(java.lang.String truststoreType, java.lang.String credentialType) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.io.IOException, java.security.cert.CertificateException, java.security.UnrecoverableKeyException
truststoreType
- credentialType
- java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException
java.security.UnrecoverableKeyException
public static org.apache.http.conn.ssl.SSLSocketFactory createSSLSocketFactory(TrustStore truststore) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.io.IOException, java.security.cert.CertificateException, java.security.UnrecoverableKeyException
truststore
- java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException
java.security.UnrecoverableKeyException
public static org.apache.http.conn.ssl.SSLSocketFactory createSSLSocketFactory(byte[] truststore, java.lang.String password) throws java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException, java.io.IOException, java.security.cert.CertificateException, java.security.UnrecoverableKeyException
truststore
- password
- java.security.KeyStoreException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
java.io.IOException
java.security.cert.CertificateException
java.security.UnrecoverableKeyException
public static AtakCertificateDatabase.CertificateValidity validateCert(java.lang.String hostname)
hostname
- public static AtakCertificateDatabase.CertificateValidity validateCert(java.lang.String hostname, int port)
hostname
- port
- public static void promptCertificateError(android.content.Context context, java.lang.String host, java.lang.String message, boolean interactive)