SimulateX509Device
所属分类:CA认证
开发工具:C#
文件大小:0KB
下载次数:0
上传日期:2021-04-30 19:44:55
上 传 者:
sh-1993
说明: 使用x.509证书模拟连接到物联网中心的设备的代码示例。,
(Code sample to simulate a device connected to IoT Hub using an x.509 certificate.,)
文件列表:
App.config (1293, 2021-04-30)
LICENSE (1071, 2021-04-30)
Program.cs (3611, 2021-04-30)
Properties/ (0, 2021-04-30)
Properties/AssemblyInfo.cs (1407, 2021-04-30)
SimulateX509Device.csproj (15324, 2021-04-30)
SimulateX509Device.sln (1116, 2021-04-30)
packages.config (6233, 2021-04-30)
# SimulateX509Device
Code sample to simulate a device connected to IoT Hub using an x.509 certificate.
# Setup
- In IoT Hub:
- Under **Certificates**, upload your signing certificate (e.g. Intermediate cert) and verify it.
- Under **IoT Device**, create a new IoT device. Select **X.509 CA Signed** and make note of the **Device ID** you create.
- Using OpenSSL, generate a certificate for your IoT device as follows. In this example, the **Device ID** is ```device123```.
```
// Generate key pair for device; output is a pem file (pkcs8 format)
openssl genrsa -out device123.key 2048
// Generate CSR. Fill in the questions and ensure CN = device123
openssl req -new -key device123.key -out device123.csr
// Generate device cert signed using intermediate CA cert and key
openssl x509 -req -days 1730 -in device123.csr -CA ia.cer -CAkey ia.key -set_serial 01 -out device123.cer
// The IoT Device SDK needs both the Signed Certificate as well as the private key information.
// It expects to load a single PFX-formatted Bundle containing all necessarily information.
// We can combine the Key and Certificate to a PFX archive as follows:
openssl pkcs12 -export -out device123.pfx -inkey device123.key -in device123.cer
```
- Open ```Program.cs``` and update ```deviceId``` ```pfxPath``` and ```iotHubFqdn```
- Build and run the sample.
近期下载者:
相关文件:
收藏者: