Skip to content

Commit a8c391c

Browse files
authored
Merge pull request #228000 from KennedyDMSFT/US61610
User Story 61610
2 parents 418b4a7 + acca6fd commit a8c391c

6 files changed

+95
-133
lines changed

articles/iot-hub/.openpublishing.redirection.iot-hub.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,11 @@
11281128
"redirect_url": "/azure/iot-hub/reference-x509-certificates",
11291129
"redirect_document_id": true
11301130
},
1131+
{
1132+
"source_path_from_root": "/articles/iot-hub/tutorial-x509-self-sign.md",
1133+
"redirect_url": "/azure/iot-hub/reference-x509-certificates",
1134+
"redirect_document_id": false
1135+
},
11311136
{
11321137
"source_path_from_root": "/articles/iot-hub/tutorial-x509-scripts.md",
11331138
"redirect_url": "/azure/iot-hub/tutorial-x509-openssl",

articles/iot-hub/TOC.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@
5050
- name: Use OpenSSL to create test certificates
5151
displayName: X.509 certificates, root CA
5252
href: tutorial-x509-openssl.md
53-
- name: Create self-signed certificates
54-
displayName: X.509 certificates, OpenSSL, CSR, thumbprint
55-
href: tutorial-x509-self-sign.md
5653
- name: Upload and verify CA certificates
5754
displayName: root certification authority (CA), verify certificate, manual verification, verification code, certificate signing request (CSR)
5855
href: tutorial-x509-prove-possession.md
@@ -538,7 +535,7 @@
538535
- name: Azure Policy built-ins
539536
href: ./policy-reference.md
540537
- name: X.509 certificates
541-
displayName: certification authority (CA), subordinate CA, certificate versions, unique identifier, key identifier, binary certificate, PEM certificate, PKCS
538+
displayName: certificate authority (CA), subordinate CA, certificate versions, unique identifier, key identifier, binary certificate, PEM certificate, PKCS, X.509 certificates, OpenSSL, CSR, thumbprint
542539
href: reference-x509-certificates.md
543540
- name: Feature and API retirement
544541
items:

articles/iot-hub/iot-hub-x509-certificate-concepts.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ To learn more about the fields that make up an X.509 certificate, see [X.509 cer
122122
If you're already familiar with X.509 certificates, and you want to generate test versions that you can use to authenticate to your IoT hub, see the following articles:
123123

124124
* [Tutorial: Use OpenSSL to create test certificates](tutorial-x509-openssl.md)
125-
* [Tutorial: Use OpenSSL to create self-signed certificates](tutorial-x509-self-sign.md)
125+
* If you want to use self-signed certificates for testing, see the [Create a self-signed certificate](reference-x509-certificates.md#create-a-self-signed-certificate) section of [X.509 certificates](reference-x509-certificates.md).
126+
127+
>[!IMPORTANT]
128+
>We recommend that you use certificates signed by an issuing Certificate Authority (CA), even for testing purposes. Never use self-signed certificates in production.
126129
127130
If you have a root CA certificate or subordinate CA certificate and you want to upload it to your IoT hub, you must verify that you own that certificate. For more information, see [Tutorial: Upload and verify a CA certificate to IoT Hub](tutorial-x509-prove-possession.md).

articles/iot-hub/reference-x509-certificates.md

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ms.custom: [mvc, 'Role: Cloud Development', 'Role: Data Analytics']
1414

1515
# X.509 certificates
1616

17-
X.509 certificates are digital documents that represent a user, computer, service, or device. They're issued by a certification authority (CA), subordinate CA, or registration authority and contain the public key of the certificate subject. They don't contain the subject's private key, which must be stored securely. Public key certificates are documented by [RFC 5280](https://tools.ietf.org/html/rfc5280). They're digitally signed and, in general, contain the following information:
17+
X.509 certificates are digital documents that represent a user, computer, service, or device. A certificate authority (CA), subordinate CA, or registration authority issues X.509 certificates. The certificates contain the public key of the certificate subject. They don't contain the subject's private key, which must be stored securely. [RFC 5280](https://tools.ietf.org/html/rfc5280) documents public key certificates, including their fields and extensions. Public key certificates are digitally signed and typically contain the following information:
1818

1919
* Information about the certificate subject
2020
* The public key that corresponds to the subject's private key
@@ -42,7 +42,7 @@ The following table describes Version 1 certificate fields for X.509 certificate
4242
| [Serial Number](https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.2) | An integer that represents the unique number for each certificate issued by a certificate authority (CA). |
4343
| [Signature](https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.3) | The identifier for the cryptographic algorithm used by the CA to sign the certificate. The value includes both the identifier of the algorithm and any optional parameters used by that algorithm, if applicable. |
4444
| [Issuer](https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.4) | The distinguished name (DN) of the certificate's issuing CA. |
45-
| [Validity](https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.5) | The inclusive time period for which the certificate is considered valid. |
45+
| [Validity](https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.5) | The inclusive time period for which the certificate is valid. |
4646
| [Subject](https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.6) | The distinguished name (DN) of the certificate subject. |
4747
| [Subject Public Key Info](https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.7) | The public key owned by the certificate subject. |
4848

@@ -69,7 +69,7 @@ Certificate extensions, introduced with Version 3, provide methods for associati
6969

7070
### Standard extensions
7171

72-
The extensions included in this section are defined as part of the X.509 standard, for use in the Internet public key infrastructure (PKI).
72+
The X.509 standard defines the extensions included in this section, for use in the Internet public key infrastructure (PKI).
7373

7474
| Name | Description |
7575
| --- | --- |
@@ -108,9 +108,84 @@ Certificates can be saved in various formats. Azure IoT Hub authentication typic
108108
| Binary certificate | A raw form binary certificate using Distinguished Encoding Rules (DER) ASN.1 encoding. |
109109
| ASCII PEM format | A PEM certificate (.pem) file contains a Base64-encoded certificate beginning with `-----BEGIN CERTIFICATE-----` and ending with `-----END CERTIFICATE-----`. One of the most common formats for X.509 certificates, PEM format is required by IoT Hub when uploading certain certificates, such as device certificates. |
110110
| ASCII PEM key | Contains a Base64-encoded DER key, optionally with more metadata about the algorithm used for password protection. |
111-
| PKCS #7 certificate | A format designed for the transport of signed or encrypted data. It can include the entire certificate chain. It's defined by [RFC 2315](https://tools.ietf.org/html/rfc2315). |
112-
| PKCS #8 key | The format for a private key store. It's defined by [RFC 5208](https://tools.ietf.org/html/rfc5208). |
113-
| PKCS #12 key and certificate | A complex format that can store and protect a key and the entire certificate chain. It's commonly used with a .p12 or .pfx extension. PKCS #12 is synonymous with the PFX format. It's defined by [RFC 7292](https://tools.ietf.org/html/rfc7292). |
111+
| PKCS #7 certificate | A format designed for the transport of signed or encrypted data. It can include the entire certificate chain. [RFC 2315](https://tools.ietf.org/html/rfc2315) defines this format. |
112+
| PKCS #8 key | The format for a private key store. [RFC 5208](https://tools.ietf.org/html/rfc5208) defines this format. |
113+
| PKCS #12 key and certificate | A complex format that can store and protect a key and the entire certificate chain. It's commonly used with a .p12 or .pfx extension. PKCS #12 is synonymous with the PFX format. [RFC 7292](https://tools.ietf.org/html/rfc7292) defines this format. |
114+
115+
## Self-signed certificates
116+
117+
You can authenticate a device to your IoT hub for testing purposes by using two self-signed certificates. This type of authentication is sometimes called *thumbprint authentication* because the certificates are identified by calculated hash values called *fingerprints* or *thumbprints*. These calculated hash values are used by IoT Hub to authenticate your devices.
118+
119+
>[!IMPORTANT]
120+
>We recommend that you use certificates signed by an issuing Certificate Authority (CA), even for testing purposes. Never use self-signed certificates in production.
121+
122+
### Create a self-signed certificate
123+
124+
You can use [OpenSSL](https://www.openssl.org/) to create self-signed certificates. The following steps show you how to run OpenSSL commands in a bash shell to create a self-signed certificate and retrieve a certificate fingerprint that can be used for authenticating your device in IoT Hub.
125+
126+
>[!NOTE]
127+
>If you want to use self-signed certificates for testing, you must create two certificates for each device.
128+
129+
1. Run the following command to generate a private key and create a PEM-encoded private key (.key) file, replacing the following placeholders with their corresponding values. The private key generated by the following command uses the RSA algorithm with 2048-bit encryption.
130+
131+
*{KeyFile}*. The name of your private key file.
132+
133+
```bash
134+
openssl genpkey -out {KeyFile} -algorithm RSA -pkeyopt rsa_keygen_bits:2048
135+
```
136+
137+
1. Run the following command to generate a PKCS #10 certificate signing request (CSR) and create a CSR (.csr) file, replacing the following placeholders with their corresponding values. Make sure that you specify the device ID of the IoT device for your self-signed certificate when prompted.
138+
139+
*{KeyFile}*. The name of your private key file.
140+
141+
*{CsrFile}*. The name of your CSR file.
142+
143+
*{DeviceID}*. The name of your IoT device.
144+
145+
```bash
146+
openssl req -new -key {KeyFile} -out {CsrFile}
147+
148+
Country Name (2 letter code) [XX]:.
149+
State or Province Name (full name) []:.
150+
Locality Name (eg, city) [Default City]:.
151+
Organization Name (eg, company) [Default Company Ltd]:.
152+
Organizational Unit Name (eg, section) []:.
153+
Common Name (eg, your name or your server hostname) []:{DeviceID}
154+
Email Address []:.
155+
156+
Please enter the following 'extra' attributes
157+
to be sent with your certificate request
158+
A challenge password []:.
159+
An optional company name []:.
160+
```
161+
162+
1. Run the following command to examine and verify your CSR, replacing the following placeholders with their corresponding values.
163+
164+
*{CsrFile}*. The name of your certificate file.
165+
166+
```bash
167+
openssl req -text -in {CsrFile} -verify -noout
168+
```
169+
170+
1. Run the following command to generate a self-signed certificate and create a PEM-encoded certificate (.crt) file, replacing the following placeholders with their corresponding values. The command converts and signs your CSR with your private key, generating a self-signed certificate that expires in 365 days.
171+
172+
*{KeyFile}*. The name of your private key file.
173+
174+
*{CsrFile}*. The name of your CSR file.
175+
176+
*{CrtFile}*. The name of your certificate file.
177+
178+
```bash
179+
openssl x509 -req -days 365 -in {CsrFile} -signkey {KeyFile} -out {CrtFile}
180+
```
181+
182+
1. Run the following command to retrieve the fingerprint of the certificate, replacing the following placeholders with their corresponding values. The fingerprint of a certificate is a calculated hash value that is unique to that certificate. You need the fingerprint to configure your IoT device in IoT Hub for testing.
183+
184+
*{CrtFile}*. The name of your certificate file.
185+
186+
```bash
187+
openssl x509 -in {CrtFile} -noout -fingerprint
188+
```
114189

115190
## For more information
116191

articles/iot-hub/tutorial-x509-introduction.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ Before starting any of the articles in this tutorial, you should be familiar wit
3737

3838
## X.509 certificate scenario paths
3939

40-
Using a self-signed certificate to authenticate a device provides a quick and easy way to test IoT Hub features. Self-signed certificates shouldn't be used in production as they provide less security than a certificate chain anchored with a CA-signed certificate backed by a PKI. To learn more about creating and using a self-signed X.509 certificate to authenticate with IoT Hub, see [Tutorial: Use OpenSSL to create self-signed certificates](tutorial-x509-self-sign.md).
41-
4240
Using a CA-signed certificate chain backed by a PKI to authenticate a device provides the best level of security for your devices:
4341

4442
- In production, we recommend you get your X.509 CA certificates from a public root certificate authority. Purchasing a CA certificate has the benefit of the root CA acting as a trusted third party to vouch for the legitimacy of your devices. If you already have an X.509 CA certificate, and you know how to create and sign device certificates into a certificate chain, follow the instructions in [Tutorial: Upload and verify a CA certificate to IoT Hub](/tutorial-x509-prove-possession.md) to upload your CA certificate to your IoT hub. Then, follow the instructions in [Tutorial: Test certificate authentication](tutorial-x509-test-certificate.md) to authenticate a device with your IoT hub.
@@ -52,6 +50,9 @@ To learn more about the fields that make up an X.509 certificate, see [X.509 cer
5250
If you're already familiar with X.509 certificates, and you want to generate test versions that you can use to authenticate to your IoT hub, see the following articles:
5351

5452
* [Tutorial: Use OpenSSL to create test certificates](tutorial-x509-openssl.md)
55-
* [Tutorial: Use OpenSSL to create self-signed certificates](tutorial-x509-self-sign.md)
53+
* If you want to use self-signed certificates for testing, see the [Create a self-signed certificate](reference-x509-certificates.md#create-a-self-signed-certificate) section of [X.509 certificates](reference-x509-certificates.md).
54+
55+
>[!IMPORTANT]
56+
>We recommend that you use certificates signed by an issuing Certificate Authority (CA), even for testing purposes. Never use self-signed certificates in production.
5657
5758
If you have a root CA certificate or subordinate CA certificate and you want to upload it to your IoT hub, you must verify that you own that certificate. For more information, see [Tutorial: Upload and verify a CA certificate to IoT Hub](tutorial-x509-prove-possession.md).

articles/iot-hub/tutorial-x509-self-sign.md

Lines changed: 0 additions & 119 deletions
This file was deleted.

0 commit comments

Comments
 (0)