Skip to content

Commit a76740e

Browse files
committed
Fixed typo in example, added Bash slashes to improve readability
1 parent 257b07a commit a76740e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

articles/iot-hub/tutorial-x509-test-ca-certs.md

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ You must first create an internal root certificate authority (CA) and a self-sig
6161
| rootca/db/index | The certificate database for the root CA. The `touch` command creates a file without any content, for later use. The certificate database is a plain text file managed by OpenSSL that contains information about issued certificates. For more information about the certificate database, see the [openssl-ca](https://www.openssl.org/docs/man3.1/man1/openssl-ca.html) manual page in [OpenSSL documentation](https://www.openssl.org/docs/). |
6262
| rootca/db/serial | A file used to store the serial number of the next certificate to be created for the root CA. The `openssl` command creates a 16-byte random number in hexadecimal format, then stores it in this file to initialize the file for creating the root CA certificate. |
6363
| rootca/db/crlnumber | A file used to store serial numbers for revoked certificates issued by the root CA. The `echo` command pipes a sample serial number, 1001, into the file. |
64-
| rootca/private | The directory in which private files for the root CA, including the private key, are stored.<br/><br/>The files in this directory must be secured and protected. |
64+
| rootca/private | The directory in which private files for the root CA, including the private key, are stored.<br/>The files in this directory must be secured and protected. |
6565

6666
```bash
6767
mkdir rootca
@@ -160,7 +160,8 @@ You must first create an internal root certificate authority (CA) and a self-sig
160160
> 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.
161161
162162
```bash
163-
openssl req -new -config rootca.conf -out rootca.csr -keyout private/rootca.key
163+
openssl req -new -config rootca.conf -out rootca.csr \
164+
-keyout private/rootca.key
164165
```
165166
166167
You're prompted to provide a PEM pass phrase, as shown below, for the private key file. Provide and confirm a pass phrase to generate your private key and CSR.
@@ -176,7 +177,8 @@ You must first create an internal root certificate authority (CA) and a self-sig
176177
1. In the 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](https://www.openssl.org/docs/).
177178

178179
```bash
179-
openssl ca -selfsign -config rootca.conf -in rootca.csr -out rootca.crt -extensions ca_ext
180+
openssl ca -selfsign -config rootca.conf -in rootca.csr -out rootca.crt \
181+
-extensions ca_ext
180182
```
181183

182184
You're prompted to provide the PEM pass phrase, as shown below, for the private key file. After providing the pass phrase, OpenSSL generates a certificate, then prompts you to sign and commit the certificate for your root CA. Specify *y* for both prompts to generate the self-signed certificate for your root CA.
@@ -314,7 +316,8 @@ Similar to your root CA, the files used to create and maintain your subordinate
314316
1. In the Bash window, run the following commands to generate a private key and a certificate signing request (CSR) in the subordinate CA directory.
315317

316318
```bash
317-
openssl req -new -config subca.conf -out subca.csr -keyout private/subca.key
319+
openssl req -new -config subca.conf -out subca.csr \
320+
-keyout private/subca.key
318321
```
319322

320323
You're prompted to enter a PEM pass phrase, as shown below, for the private key file. Enter and verify a pass phrase to generate your private key and CSR.
@@ -330,7 +333,8 @@ Similar to your root CA, the files used to create and maintain your subordinate
330333
1. In the 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.
331334

332335
```bash
333-
openssl ca -config ../rootca/rootca.conf -in subca.csr -out subca.crt -extensions sub_ca_ext
336+
openssl ca -config ../rootca/rootca.conf -in subca.csr -out subca.crt \
337+
-extensions sub_ca_ext
334338
```
335339

336340
You're prompted to enter the pass phrase, as shown below, for the private key file of your root CA. After you enter the pass phrase, OpenSSL generates and displays the details of the certificate, then prompts you to sign and commit the certificate for your subordinate CA. Specify *y* for both prompts to generate the certificate for your subordinate CA.
@@ -342,7 +346,7 @@ Similar to your root CA, the files used to create and maintain your subordinate
342346
Signature ok
343347
Certificate Details:
344348
{Details omitted from output for clarity}
345-
Certificate is to be certified until Mar 24 18:51:41 2033 GMT (3650 days)
349+
Certificate is to be certified until Mar 24 18:55:00 2024 GMT (365 days)
346350
Sign the certificate? [y/n]:
347351
348352
@@ -401,7 +405,8 @@ Perform the following steps to:
401405

402406
```bash
403407
cd {subca_dir}
404-
openssl genpkey -out private/{device_name}.key -algorithm RSA -pkeyopt rsa_keygen_bits:2048
408+
openssl genpkey -out private/{device_name}.key -algorithm RSA \
409+
-pkeyopt rsa_keygen_bits:2048
405410
openssl req -new -key private/{device_name}.key -out {device_name}.csr
406411
```
407412

@@ -435,7 +440,8 @@ Perform the following steps to:
435440
1. In the Bash window, run the following command, replacing the following placeholders with their corresponding values. This step creates a client certificate in the subordinate CA directory. The command applies the `client_ext` configuration file extensions to the certificate. These extensions indicate that the certificate is for a client certificate, which can't be used as a CA certificate. The client certificate is signed with the subordinate CA certificate.
436441
437442
```bash
438-
openssl ca -config subca.conf -in {device_name}.csr -out {device_name}.crt -extensions client_ext
443+
openssl ca -config subca.conf -in {device_name}.csr -out {device_name}.crt \
444+
-extensions client_ext
439445
```
440446
441447
You're prompted to enter the pass phrase, as shown below, for the private key file of your subordinate CA. After you enter the pass phrase, OpenSSL generates and displays the details of the certificate, then prompts you to sign and commit the client certificate for your device. Specify *y* for both prompts to generate the client certificate.

0 commit comments

Comments
 (0)