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 X.509 certificates to authenticate devices to your IoT hub. For production environments, we recommend that you purchase an X.509 CA certificate from a professional certificate services vendor. You can then issue certificates within your organization from an internal, self-managed certificate authority (CA) chained to the purchased CA certificate as part of a comprehensive public key infrastructure (PKI) strategy. For more information about getting an X.509 CA certificate from a professional certificate services vendor, see the [Get an X.509 CA certificate](iot-hub-x509ca-overview.md#get-an-x509-ca-certificate) section of [Authenticate devices using X.509 CA certificates](iot-hub-x509ca-overview.md).
19
19
20
-
However, creating your own self-managed, private CA that uses an internal root CA as the trust anchor is adequate for testing environments. A self-managed private CA with at least one subordinate CA chained to your internal root CA, with client certificates for your devices that are signed by your subordinate CAs, allows you to simulate a recommended production environment.
20
+
However, creating your own self-managed, private CA that uses an internal root CA as the trust anchor is adequate for testing environments. A self-managed private CA with at least one subordinate CA chained to your internal root CA, with client certificates for your devices signed by your subordinate CAs, allows you to simulate a recommended production environment.
21
21
22
22
>[!IMPORTANT]
23
-
>We do not recommend the use of self-signed certificates for production environments. This tutorial is presented for demonstration purposes only.
23
+
>We don't recommend the use of self-signed certificates for production environments. This tutorial is presented for demonstration purposes only.
24
24
25
25
The following tutorial uses [OpenSSL](https://www.openssl.org/) and the [OpenSSL Cookbook](https://www.feistyduck.com/library/openssl-cookbook/online/ch-openssl.html) to describe how to accomplish the following tasks:
26
26
@@ -44,7 +44,7 @@ The following tutorial uses [OpenSSL](https://www.openssl.org/) and the [OpenSSL
44
44
* An [OpenSSL](https://www.openssl.org/) installation. On Windows, your installation of Git includes an installation of OpenSSL. You can access OpenSSL from the Git Bash prompt. To verify that OpenSSL is installed, open a Git Bash prompt and enter `openssl version`.
45
45
46
46
> [!NOTE]
47
-
> Unless you're familiar with OpenSSL and already have it installed on your Windows machine, we recommend using OpenSSL from the Git Bash prompt. Alternatively, you can choose to download the source code and build OpenSSL. To learn more, see the [OpenSSL Downloads](https://www.openssl.org/source/) page. Or, you can download OpenSSL pre-built from a third-party. To learn more, see the [OpenSSL wiki](https://wiki.openssl.org/index.php/Binaries). Microsoft makes no guarantees about the validity of packages downloaded from third-parties. If you do choose to build or download OpenSSL make sure that the OpenSSL binary is accessible in your path and that the `OPENSSL_CNF` environment variable is set to the path of your *openssl.cnf* file.
47
+
> Unless you're familiar with OpenSSL and it's already installed on your Windows machine, we recommend using OpenSSL from the Git Bash prompt. Alternatively, you can choose to download the source code and build OpenSSL. To learn more, see the [OpenSSL Downloads](https://www.openssl.org/source/) page. Or, you can download OpenSSL prebuilt from a non-Microsoft partner. To learn more, see the [OpenSSL wiki](https://wiki.openssl.org/index.php/Binaries). Microsoft makes no guarantees about the validity of packages downloaded from third-parties. If you do choose to build or download OpenSSL, make sure that the OpenSSL binary is accessible in your path and that the `OPENSSL_CNF` environment variable is set to the path of your *openssl.cnf* file.
48
48
49
49
## Create a root CA
50
50
@@ -165,7 +165,7 @@ You must first create an internal root certificate authority (CA) and a self-sig
165
165
1. In the Git Bash window, run the following command to generate a certificate signing request (CSR) in the `rootca` directory and a private key in the `rootca/private` directory. For more information about the OpenSSL `req` command, see the [openssl-req](https://www.openssl.org/docs/man3.1/man1/openssl-req.html) manual page in OpenSSL documentation.
166
166
167
167
> [!NOTE]
168
-
>Even though this root CA is for testing purposes and won't be exposed as part of a public key infrastructure (PKI), we recommend that you do not copy or share the private key.
168
+
>we recommend that you don't copy or share the private key even though this root CA is for testing purposes and isn't exposed as part of a public key infrastructure (PKI).
169
169
170
170
# [Windows](#tab/windows)
171
171
@@ -189,7 +189,7 @@ You must first create an internal root certificate authority (CA) and a self-sig
189
189
-----
190
190
```
191
191
192
-
Confirm that the CSR file, `rootca.csr`, is present in the `rootca` directory and the private key file, `rootca.key`, is present in the `private` subdirectory before continuing.
192
+
Confirm that the CSR file, `rootca.csr`, is present in the `rootca` directory. Then, confirm that the private key file, `rootca.key`, is present in the `private` subdirectory before continuing.
193
193
194
194
1. In the Git Bash window, run the following command to create a self-signed root CA certificate. The command applies the `ca_ext` configuration file extensions to the certificate. These extensions indicate that the certificate is for a root CA and can be used to sign certificates and certificate revocation lists (CRLs). For more information about the OpenSSL `ca` command, see the [openssl-ca](https://www.openssl.org/docs/man3.1/man1/openssl-ca.html) manual page in OpenSSL documentation.
195
195
@@ -222,14 +222,14 @@ You must first create an internal root certificate authority (CA) and a self-sig
222
222
223
223
1 out of 1 certificate requests certified, commit? [y/n]
224
224
Write out database with 1 new entries
225
-
Data Base Updated
225
+
Database updated
226
226
```
227
227
228
228
After OpenSSL updates the certificate database, confirm that both the certificate file, `rootca.crt`, is present in the `rootca` directory and the PEM certificate (.pem) file forthe certificate is presentin the `rootca/certs` directory. The file name of the .pem file matches the serial number of the root CA certificate.
229
229
230
230
## Create a subordinate CA
231
231
232
-
After you've created your internal root CA, you should create a subordinate CA to use as an *intermediate CA* with which to sign client certificates for your devices. In theory, you don't need to create a subordinate CA; you can upload your root CA certificate to your IoT hub and sign client certificates directly from your root CA. However, using a subordinate CA as an intermediate CA to sign client certificates more closely simulates a recommended production environment, in which your root CA is kept offline. You can also use a subordinate CA to sign another subordinate CA, which in turn can sign another subordinate CA, and so on. Using subordinate CAs to sign other subordinate CAs creates a hierarchy of intermediate CAs as part of a *certificate chain of trust.* In a production environment, the certificate chain of trust allows a delegation of trust towards signing devices. For more information about signing devices into a certificate chain of trust, see [Authenticate devices using X.509 CA certificates](iot-hub-x509ca-overview.md#sign-devices-into-the-certificate-chain-of-trust).
232
+
After you create your internal root CA, you should create a subordinate CA to use as an *intermediate CA* with which to sign client certificates for your devices. In theory, you don't need to create a subordinate CA; you can upload your root CA certificate to your IoT hub and sign client certificates directly from your root CA. However, using a subordinate CA as an intermediate CA to sign client certificates more closely simulates a recommended production environment, in which your root CA is kept offline. You can also use a subordinate CA to sign another subordinate CA, which in turn can sign another subordinate CA, and so on. Using subordinate CAs to sign other subordinate CAs creates a hierarchy of intermediate CAs as part of a *certificate chain of trust.* In a production environment, the certificate chain of trust allows a delegation of trust towards signing devices. For more information about signing devices into a certificate chain of trust, see [Authenticate identities with X.509 certificates](iot-hub-x509ca-overview.md#sign-devices-into-the-certificate-chain-of-trust).
233
233
234
234
Similar to your root CA, the files used to create and maintain your subordinate CA are stored in a folder structure and initialized as part of this process. Perform the following steps to:
235
235
@@ -246,7 +246,7 @@ Similar to your root CA, the files used to create and maintain your subordinate
246
246
247
247
1. In the Git Bash window, run the following commands, one at a time.
248
248
249
-
This step creates a directory structure and support files for the subordinate CA similar to the folder structure and files created for the root CA in the previous section.
249
+
This step creates a directory structure and support files forthe subordinate CA that is similar to the folder structure and files created for the root CAin the previous section.
250
250
251
251
```bash
252
252
mkdir subca
@@ -262,7 +262,7 @@ Similar to your root CA, the files used to create and maintain your subordinate
262
262
263
263
As with the configuration file for your test root CA, this file provides OpenSSL with the values needed to configure your test subordinate CA. You can create multiple subordinate CAs, for managing testing scenarios or environments.
264
264
265
-
For more information about the syntax of OpenSSL configuration files, see the [config](https://www.openssl.org/docs/manmaster/man5/config.html) master manual page in OpenSSL documentation.
265
+
For more information about the syntax of OpenSSL configuration files, see the [config](https://docs.openssl.org/master/man5/config/) master manual page in OpenSSL documentation.
266
266
267
267
```bash
268
268
[default]
@@ -354,7 +354,7 @@ Similar to your root CA, the files used to create and maintain your subordinate
354
354
-----
355
355
```
356
356
357
-
Confirm that the CSR file `subca.csr` is present in the subordinate CA directory and the private key file `subca.key` is present in the `private` subdirectory before continuing.
357
+
Confirm that the CSR file `subca.csr` is present in the subordinate CA directory. Then, confirm that the private key file `subca.key` is present in the `private` subdirectory before continuing.
358
358
359
359
1. In the Git Bash window, run the following command to create a subordinate CA certificate in the subordinate CA directory. The command applies the `sub_ca_ext` configuration file extensions to the certificate. These extensions indicate that the certificate is for a subordinate CA and can also be used to sign certificates and certificate revocation lists (CRLs). Unlike the root CA certificate, this certificate isn't self-signed. Instead, the subordinate CA certificate is signed with the root CA certificate, establishing a certificate chain similar to what you would use for a public key infrastructure (PKI). The subordinate CA certificate is then used to sign client certificates for testing your devices.
360
360
@@ -387,10 +387,10 @@ Similar to your root CA, the files used to create and maintain your subordinate
387
387
388
388
1 out of 1 certificate requests certified, commit? [y/n]
389
389
Write out database with 1 new entries
390
-
Data Base Updated
390
+
Database updated
391
391
```
392
392
393
-
After OpenSSL updates the certificate database, confirm that the certificate file `subca.crt` is present in the subordinate CA directory and that the PEM certificate (.pem) file forthe certificate is presentin the `rootca/certs` directory. The file name of the .pem file matches the serial number of the subordinate CA certificate.
393
+
After OpenSSL updates the certificate database, confirm that the certificate file `subca.crt` is present in the subordinate CA directory. Then, confirm that the PEM certificate (.pem) file for the certificate is present in the `rootca/certs` directory. The file name of the .pem file matches the serial number of the subordinate CA certificate.
394
394
395
395
## Register your subordinate CA certificate to your IoT hub
396
396
@@ -414,7 +414,7 @@ Your uploaded subordinate CA certificate is shown with its status set to **Verif
414
414
415
415
## Create a client certificate for a device
416
416
417
-
After you've created your subordinate CA, you can create client certificates for your devices. The files and folders created for your subordinate CA are used to store the CSR, private key, and certificate files for your client certificates.
417
+
After you created your subordinate CA, you can create client certificates for your devices. The files and folders created for your subordinate CA are used to store the CSR, private key, and certificate files for your client certificates.
418
418
419
419
The client certificate must have the value of its Subject Common Name (CN) field set to the value of the device ID that is used when registering the corresponding device in Azure IoT Hub.
420
420
@@ -469,7 +469,7 @@ Perform the following steps to:
469
469
470
470
```
471
471
472
-
Confirm that the CSR file is present in the subordinate CA directory and the private key file is present in the `private` subdirectory before continuing. For more information about the formats of the CSR and private key files, see [X.509 certificates](reference-x509-certificates.md#certificate-formats).
472
+
Confirm that the CSR file is present in the subordinate CA directory. Then, confirm that the private key file is present in the `private` subdirectory before continuing. For more information about the formats of the CSR and private key files, see [X.509 certificates](reference-x509-certificates.md#certificate-formats).
473
473
474
474
1. In the Git Bash window, run the following command, replacing the device name placeholders with the same name you used in the previous steps.
475
475
@@ -504,13 +504,13 @@ Perform the following steps to:
504
504
505
505
1 out of 1 certificate requests certified, commit? [y/n]
506
506
Write out database with 1 new entries
507
-
Data Base Updated
507
+
Database updated
508
508
```
509
509
510
-
After OpenSSL updates the certificate database, confirm that the certificate file forthe client certificate is presentin the subordinate CA directory and that the PEM certificate (.pem) file forthe client certificate is presentin the *certs* subdirectory of the subordinate CA directory. The file name of the .pem file matches the serial number of the client certificate.
510
+
After OpenSSL updates the certificate database, confirm that the certificate file forthe client certificate is presentin the subordinate CA directory. Then, confirm that the PEM certificate (.pem) file forthe client certificate is presentin the *certs* subdirectory of the subordinate CA directory. The file name of the .pem file matches the serial number of the client certificate.
511
511
512
512
## Next steps
513
513
514
-
You can register your device with your IoT hub for testing the client certificate that you've created for that device. For more information about registering a device, see [Create and manage device identities](create-connect-device.md).
514
+
You can register your device with your IoT hub for testing the client certificate that you created for that device. For more information about registering a device, see [Create and manage device identities](create-connect-device.md).
515
515
516
516
If you have multiple related devices to test, you can use the Azure IoT Hub Device Provisioning Service to provision multiple devices in an enrollment group. For more information about using enrollment groups in the Device Provisioning Service, see [Tutorial: Provision multiple X.509 devices using enrollment groups](../iot-dps/tutorial-custom-hsm-enrollment-group-x509.md).
0 commit comments