Partager via


IotHubSSLContext Class

  • java.lang.Object
    • com.microsoft.azure.sdk.iot.deps.auth.IotHubSSLContext

public class IotHubSSLContext

Constructor Summary

Constructor Description
IotHubSSLContext()

Creates a SSLContext for the IotHub.

IotHubSSLContext(String trustedCert, boolean isPath)

Creates a default SSLContext for the IotHub with the specified certificate.

IotHubSSLContext(String publicKeyCertificateString, String privateKeyString)

Constructor that takes a public key certificate and private key pair.

IotHubSSLContext(String publicKeyCertificateString, String privateKeyString, String cert, boolean isPath)

Creates a default SSLContext for the IotHub with the specified certificate.

IotHubSSLContext(SSLContext sslContext)

Constructor that takes and saves an SSLContext object

Method Summary

Modifier and Type Method and Description
javax.net.ssl.SSLContext getSSLContext()

Getter for the IotHubSSLContext

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

IotHubSSLContext

public IotHubSSLContext()

Creates a SSLContext for the IotHub.

Throws:

java.security.KeyStoreException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.KeyManagementException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.io.IOException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.cert.CertificateException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.NoSuchAlgorithmException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.

IotHubSSLContext

public IotHubSSLContext(String trustedCert, boolean isPath)

Creates a default SSLContext for the IotHub with the specified certificate.

Parameters:

trustedCert - the certificate to be trusted
isPath - if the trustedCert is a path to the trusted cert, or if it is the certificate itself

Throws:

java.security.KeyStoreException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.KeyManagementException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.io.IOException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.cert.CertificateException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.NoSuchAlgorithmException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.

IotHubSSLContext

public IotHubSSLContext(String publicKeyCertificateString, String privateKeyString)

Constructor that takes a public key certificate and private key pair.

Parameters:

publicKeyCertificateString - The PEM formatted public key certificate string
privateKeyString - The PEM formatted private key string

Throws:

java.security.KeyManagementException - If the SSLContext could not be initialized
java.io.IOException - If the SSLContext could not be initialized
java.security.cert.CertificateException - If the SSLContext could not be initialized
java.security.KeyStoreException - If the SSLContext could not be initialized
java.security.NoSuchAlgorithmException - If the SSLContext could not be initialized
java.security.UnrecoverableKeyException - If the SSLContext could not be initialized

IotHubSSLContext

public IotHubSSLContext(String publicKeyCertificateString, String privateKeyString, String cert, boolean isPath)

Creates a default SSLContext for the IotHub with the specified certificate.

Parameters:

publicKeyCertificateString - the public key for x509 authentication
privateKeyString - the private key for x509 authentication
cert - the trusted certificate
isPath - If the provided cert is a path, or the actual certificate itself

Throws:

java.security.KeyStoreException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.KeyManagementException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.io.IOException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.cert.CertificateException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.NoSuchAlgorithmException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
java.security.UnrecoverableKeyException - if no Provider supports a KeyStoreSpi implementation for the specified type or if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.

IotHubSSLContext

public IotHubSSLContext(SSLContext sslContext)

Constructor that takes and saves an SSLContext object

Parameters:

sslContext - the ssl context to save

Method Details

getSSLContext

public SSLContext getSSLContext()

Getter for the IotHubSSLContext

Returns:

SSLContext defined for the IotHub.

Applies to