尝试使用自己的 x509 证书 运行 azure-iot-sdk-java provisioning-x509-sample
Try to run the azure-iot-sdk-java provisioning-x509-sample with an own x509-certificate
我正在尝试 运行 azure-iot-sdk-java provisioning-X509-sample。
jet 所做的是,我使用 openssl 创建了一个证书链并生成了一个 X509 证书。我将此证书上传到 Azure DPS。
我检查了上传证书的指纹,一切正常。
在下一步中,我配置 ProvisioningX509Sample.java。输入 idScope、globalEndpoint,作为 leafPublicPem,我输入 Base64 字符串
"-----BEGIN CERTIFICATE-----" + "\n" +
************ + "\n" +
"-----END CERTIFICATE-----"
另外,作为 leafPrivateKey,我输入我的中间 ca 的私钥,create/sign 我的 X509-Device-certifivate
"-----BEGIN RSA PRIVATE KEY-----" + "\n" +
************+ "\n" +
"-----END RSA PRIVATE KEY-----";
作为传输协议,我将使用 MQTT
如果我运行这个样本我得到以下错误
Starting...
Beginning setup.
Waiting for Provisioning Service to register
com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions.ProvisioningDeviceConnectionException: Exception opening connection amqp
at com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.mqtt.ContractAPIMqtt.open(ContractAPIMqtt.java:142)
at com.microsoft.azure.sdk.iot.provisioning.device.internal.task.ProvisioningTask.call(ProvisioningTask.java:267)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Unable to connect to mqtt service
at com.microsoft.azure.sdk.iot.deps.transport.mqtt.MqttConnection.connect(MqttConnection.java:151)
at com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.mqtt.ContractAPIMqtt.open(ContractAPIMqtt.java:135)
... 5 more
Caused by: MqttException (0) - javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:38)
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:715)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
... 3 more
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1002)
at sun.security.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1779)
at sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:124)
at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1156)
at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1267)
at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1179)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:348)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
at org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule.java:108)
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:701)
... 7 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(InputRecord.java:505)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
... 21 more
Registration error, bailing out
Press any key to exit...
我不明白这个错误。是否还缺少其他步骤?
感谢您的帮助和最诚挚的问候
JensV
DPS 仅支持 TLS 1.2。来自旧版本的 TLS 连接将被拒绝。
我正在尝试 运行 azure-iot-sdk-java provisioning-X509-sample。
jet 所做的是,我使用 openssl 创建了一个证书链并生成了一个 X509 证书。我将此证书上传到 Azure DPS。 我检查了上传证书的指纹,一切正常。
在下一步中,我配置 ProvisioningX509Sample.java。输入 idScope、globalEndpoint,作为 leafPublicPem,我输入 Base64 字符串
"-----BEGIN CERTIFICATE-----" + "\n" +
************ + "\n" +
"-----END CERTIFICATE-----"
另外,作为 leafPrivateKey,我输入我的中间 ca 的私钥,create/sign 我的 X509-Device-certifivate
"-----BEGIN RSA PRIVATE KEY-----" + "\n" +
************+ "\n" +
"-----END RSA PRIVATE KEY-----";
作为传输协议,我将使用 MQTT
如果我运行这个样本我得到以下错误
Starting...
Beginning setup.
Waiting for Provisioning Service to register
com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions.ProvisioningDeviceConnectionException: Exception opening connection amqp
at com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.mqtt.ContractAPIMqtt.open(ContractAPIMqtt.java:142)
at com.microsoft.azure.sdk.iot.provisioning.device.internal.task.ProvisioningTask.call(ProvisioningTask.java:267)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.io.IOException: Unable to connect to mqtt service
at com.microsoft.azure.sdk.iot.deps.transport.mqtt.MqttConnection.connect(MqttConnection.java:151)
at com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.mqtt.ContractAPIMqtt.open(ContractAPIMqtt.java:135)
... 5 more
Caused by: MqttException (0) - javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:38)
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:715)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
... 3 more
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1002)
at sun.security.ssl.SSLSocketImpl.waitForClose(SSLSocketImpl.java:1779)
at sun.security.ssl.HandshakeOutStream.flush(HandshakeOutStream.java:124)
at sun.security.ssl.Handshaker.sendChangeCipherSpec(Handshaker.java:1156)
at sun.security.ssl.ClientHandshaker.sendChangeCipherAndFinish(ClientHandshaker.java:1267)
at sun.security.ssl.ClientHandshaker.serverHelloDone(ClientHandshaker.java:1179)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:348)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1052)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:987)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1072)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
at org.eclipse.paho.client.mqttv3.internal.SSLNetworkModule.start(SSLNetworkModule.java:108)
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:701)
... 7 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
at sun.security.ssl.InputRecord.read(InputRecord.java:505)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
... 21 more
Registration error, bailing out
Press any key to exit...
我不明白这个错误。是否还缺少其他步骤?
感谢您的帮助和最诚挚的问候
JensV
DPS 仅支持 TLS 1.2。来自旧版本的 TLS 连接将被拒绝。