IotHubX509SoftwareAuthenticationProvider Class

public class IotHubX509SoftwareAuthenticationProvider
extends IotHubAuthenticationProvider

Field Summary

Modifier and Type Field and Description
protected IotHubX509 iotHubX509

Constructor Summary

Constructor Description
IotHubX509SoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, String publicKeyCertificate, boolean isCertificatePath, String privateKey, boolean isPrivateKeyPath)

Constructor that takes in a connection string and certificate/private key pair needed to use x509 authentication

IotHubX509SoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, SSLContext sslContext)

Method Summary

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

Getter for IotHubSSLContext

Methods inherited from IotHubAuthenticationProvider

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

Field Details

iotHubX509

protected IotHubX509 iotHubX509

Constructor Details

IotHubX509SoftwareAuthenticationProvider

public IotHubX509SoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, String publicKeyCertificate, boolean isCertificatePath, String privateKey, boolean isPrivateKeyPath)

Constructor that takes in a connection string and certificate/private key pair needed to use x509 authentication

Parameters:

hostname - the IotHub host name
gatewayHostname - The gateway hostname to use, or null if connecting to an IotHub
deviceId - The device to be authenticated.
moduleId - The module to be authenticated. May be null if this authentication is not for a module
publicKeyCertificate - The PEM encoded string for the public key certificate or the path to a file containing it
isCertificatePath - If the provided publicKeyCertificate is a path to the PEM encoded public key certificate file
privateKey - The PEM encoded string for the private key or the path to a file containing it.
isPrivateKeyPath - If the provided privateKey is a path to the PEM encoded private key file

Throws:

java.lang.IllegalArgumentException - if the public key certificate or private key is null or empty

IotHubX509SoftwareAuthenticationProvider

public IotHubX509SoftwareAuthenticationProvider(String hostname, String gatewayHostname, String deviceId, String moduleId, SSLContext sslContext)

Parameters:

hostname
gatewayHostname
deviceId
moduleId
sslContext

Throws:

java.lang.IllegalArgumentException

Method Details

getSSLContext

public SSLContext getSSLContext()

Getter for IotHubSSLContext

Overrides:

IotHubX509SoftwareAuthenticationProvider.getSSLContext()

Returns:

The value of IotHubSSLContext

Throws:

java.io.IOException - if an error occurs when generating the SSLContext

Applies to