You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can use the following C# code example to test that your certificate can authenticate your device to your IoT Hub. Note that you must do the following before you run the test code:
17
+
You can use the following C# code example to test that your certificate can authenticate your device to your IoT hub. Note that you must complete the following prerequisites before you run the test code:
18
18
19
19
* Create a root CA or subordinate CA certificate.
20
-
* Upload your CA certificate to your IoT Hub.
20
+
* Upload your CA certificate to your IoT hub.
21
21
* Prove that you possess the CA certificate.
22
-
* Add a device to your IoT Hub.
23
-
* Create a device certificate with the same device ID as your your device.
22
+
* Add a device to your IoT hub.
23
+
* Create a device certificate with the same device ID as your device.
24
24
25
25
>[!IMPORTANT]
26
-
>The authentication process checks that your device is associated with the correct IoT Hub name.
26
+
>The authentication process checks that your device is associated with the correct IoT hub name.
27
27
28
28
## Code Example
29
29
30
-
The following code example shows how to create a C# application to simulate the X.509 device registered for your IoT hub. The example sends temperature and humidity values from the simulated device to your hub. In this tutorial, we will create only the device application. It is left as an exercise to the readers to create the IoT Hub service application that will send responses to the events sent by this simulated device.
30
+
The following code example shows how to create a C# application to simulate the X.509 device registered for your IoT hub. The example sends temperature and humidity values from the simulated device to your hub. In this tutorial, we will create only the device application. It is left as an exercise to the readers to create the IoT Hub service application that sends responses to the events sent by this simulated device.
31
31
32
32
1. Open Visual Studio, select **Create a new project**, and then choose the **Console App (.NET Framework)** project template. Select **Next**.
33
33
@@ -72,7 +72,7 @@ namespace SimulateX509Device
72
72
stringdataBuffer;
73
73
Console.WriteLine("Device sending {0} messages to IoTHub...\n", MESSAGE_COUNT);
74
74
75
-
// Iterate MESSAGE_COUNT times to set randomm termperature and humidity values.
75
+
// Iterate MESSAGE_COUNT times to set random temperature and humidity values.
76
76
for (intcount=0; count<MESSAGE_COUNT; count++)
77
77
{
78
78
// Set random values for temperature and humidity.
0 commit comments