Tool class for easy manipulation of CA certificates over the SSL network. The developer should avoid a direct usage of this class when connecting to an official CloudPlugs server.
More...
|
static void | trustEveryone () |
|
static void | trustCloudPlugs () throws KeyManagementException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static void | trustCA (Certificate ca) throws KeyManagementException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static Certificate | getCA (String ca, String type) throws CertificateException, UnsupportedEncodingException |
|
static Certificate | getCA (String ca) throws CertificateException, UnsupportedEncodingException |
|
static Certificate | getCA (byte[] ca, String type) throws CertificateException |
|
static Certificate | getCA (byte[] ca) throws CertificateException |
|
static Certificate | getCA (InputStream ca, String type) throws CertificateException |
|
static Certificate | getCA (InputStream ca) throws CertificateException |
|
static TrustManagerFactory | getTrustManagerFactoryOf (Certificate ca, String entry) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static TrustManagerFactory | getTrustManagerFactoryOf (Certificate ca) throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static SSLSocketFactory | getSocketFactoryOf (Certificate ca) throws KeyManagementException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
Tool class for easy manipulation of CA certificates over the SSL network. The developer should avoid a direct usage of this class when connecting to an official CloudPlugs server.
◆ getCA() [1/6]
static Certificate getCA |
( |
String |
ca, |
|
|
String |
type |
|
) |
| throws CertificateException, UnsupportedEncodingException |
|
static |
Create a new instance of java.security.cert.Certificate by giving its type and its certificate encoded as a String.
- Parameters
-
ca | the certificate to trust |
type | the type of certificate to generate |
- Returns
- the instance of a java.security.cert.Certificate
- Exceptions
-
CertificateException | |
UnsupportedEncodingException | |
◆ getCA() [2/6]
static Certificate getCA |
( |
String |
ca | ) |
throws CertificateException, UnsupportedEncodingException |
|
static |
Like getCA(String, String), but using the default type "X.509".
- Parameters
-
ca | the certificate to trust |
- Returns
- the instance of a java.security.cert.Certificate
- Exceptions
-
CertificateException | |
UnsupportedEncodingException | |
◆ getCA() [3/6]
static Certificate getCA |
( |
byte [] |
ca, |
|
|
String |
type |
|
) |
| throws CertificateException |
|
static |
Create a new instance of java.security.cert.Certificate by giving its type and its certificate encoded as a byte array.
- Parameters
-
ca | the certificate to trust |
type | the type of certificate to generate |
- Returns
- the instance of generated java.security.cert.Certificate
- Exceptions
-
◆ getCA() [4/6]
static Certificate getCA |
( |
byte [] |
ca | ) |
throws CertificateException |
|
static |
Like getCA(byte[], String), but using the default type "X.509".
- Parameters
-
ca | the certificate to trust |
- Returns
- the instance of generated java.security.cert.Certificate
- Exceptions
-
◆ getCA() [5/6]
static Certificate getCA |
( |
InputStream |
ca, |
|
|
String |
type |
|
) |
| throws CertificateException |
|
static |
Create a new instance of java.security.cert.Certificate by giving its type and its certificate encoded readable by the specified java.io.InputStream.
- Parameters
-
ca | the java.io.InputStream where reading the certificate to trust |
type | the type of certificate to generate |
- Returns
- the instance of generated java.security.cert.Certificate
- Exceptions
-
◆ getCA() [6/6]
static Certificate getCA |
( |
InputStream |
ca | ) |
throws CertificateException |
|
static |
Like getCA(InputStream, String), but using the default type "X.509".
- Parameters
-
ca | the java.ioInputStream where reading the certificate to trust |
- Returns
- the instance of generated java.security.cert.Certificate
- Exceptions
-
◆ getSocketFactoryOf()
static SSLSocketFactory getSocketFactoryOf |
( |
Certificate |
ca | ) |
throws KeyManagementException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static |
Create a new instance of javax.net.ssl.SSLSocketFactory will allow safe connections with servers are using the specified certificate authority.
- Parameters
-
ca | the certificate to trust |
- Returns
- the SSL socket socket factory allows safe connections using
ca
- Exceptions
-
KeyManagementException | |
KeyStoreException | |
CertificateException | |
NoSuchAlgorithmException | |
IOException | |
◆ getTrustManagerFactoryOf() [1/2]
static TrustManagerFactory getTrustManagerFactoryOf |
( |
Certificate |
ca, |
|
|
String |
entry |
|
) |
| throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static |
Create a new instance of javax.net.ssl.TrustManagerFactory for the specified certificate and entry.
- Parameters
-
ca | the certificate to trust |
entry | the certificate entry |
- Returns
- the trust manager factory related to the specified certificate
- Exceptions
-
KeyStoreException | |
CertificateException | |
NoSuchAlgorithmException | |
IOException | |
◆ getTrustManagerFactoryOf() [2/2]
static TrustManagerFactory getTrustManagerFactoryOf |
( |
Certificate |
ca | ) |
throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static |
Create a new instance of javax.net.ssl.TrustManagerFactory for the specified certificate authority.
- Parameters
-
ca | the certificate to trust |
- Returns
- the trust manager factory related to the specified certificate authority
- Exceptions
-
KeyStoreException | |
CertificateException | |
NoSuchAlgorithmException | |
IOException | |
◆ trustCA()
static void trustCA |
( |
Certificate |
ca | ) |
throws KeyManagementException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static |
Allow safe SSL connections to any server is using the specified certificate.
- Parameters
-
ca | the certificate to trust |
- Exceptions
-
KeyManagementException | |
KeyStoreException | |
CertificateException | |
NoSuchAlgorithmException | |
IOException | |
◆ trustCloudPlugs()
static void trustCloudPlugs |
( |
| ) |
throws KeyManagementException, KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException |
|
static |
Allow safe SSL connections to the official CloudPlugs server. The developer does not need to invoke this method, it will be automatically invoked by other classes of the library.
- Exceptions
-
KeyManagementException | |
KeyStoreException | |
CertificateException | |
NoSuchAlgorithmException | |
IOException | |
◆ trustEveryone()
static void trustEveryone |
( |
| ) |
|
|
static |
Disable the peer and host verification when establishing any SSL connection, including HTTPS ones. This will allow any SSL connection also with untrusted peers in a easy way. The invocation of this method is discouraged due to security reasons, because it will permit Man-In-The-Middle attacks.