Skip to content

Commit 01d96ae

Browse files
committed
Fix device-02 script for linux
1 parent fe0be73 commit 01d96ae

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

articles/iot-dps/tutorial-custom-hsm-enrollment-group-x509.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,8 @@ In this section, you create two device certificates and their full chain certifi
606606
607607
1. To create the private key, X.509 certificate, and full chain certificate for the second device, copy and paste this script into your GitBash command prompt. To create certificates for more devices, you can modify the `registration_id` variable declared at the beginning of the script.
608608
609+
# [Windows](#tab/windows)
610+
609611
```bash
610612
registration_id=device-02
611613
echo $registration_id
@@ -615,6 +617,19 @@ In this section, you create two device certificates and their full chain certifi
615617
cat ./certs/${registration_id}.cert.pem ./certs/azure-iot-test-only.intermediate.cert.pem ./certs/azure-iot-test-only.root.ca.cert.pem > ./certs/${registration_id}-full-chain.cert.pem
616618
```
617619
620+
# [Linux](#tab/linux)
621+
622+
```bash
623+
registration_id=device-02
624+
echo $registration_id
625+
openssl genrsa -out ./private/${registration_id}.key.pem 4096
626+
openssl req -config ./openssl_device_intermediate_ca.cnf -key ./private/${registration_id}.key.pem -subj "/CN=$registration_id" -new -sha256 -out ./csr/${registration_id}.csr.pem
627+
openssl ca -batch -config ./openssl_device_intermediate_ca.cnf -passin pass:1234 -extensions usr_cert -days 30 -notext -md sha256 -in ./csr/${registration_id}.csr.pem -out ./certs/${registration_id}.cert.pem
628+
cat ./certs/${registration_id}.cert.pem ./certs/azure-iot-test-only.intermediate.cert.pem ./certs/azure-iot-test-only.root.ca.cert.pem > ./certs/${registration_id}-full-chain.cert.pem
629+
```
630+
631+
---
632+
618633
>[!NOTE]
619634
> This script uses the registration ID as the base filename for the private key and certificate files. If your registration ID contains characters that aren't valid filename characters, you'll need to modify the script accordingly.
620635
@@ -632,7 +647,7 @@ You'll use the following files in the rest of this tutorial:
632647
| device-01 private key | *private/device-01.key.pem* | Used by the device to verify ownership of the device certificate during authentication with DPS. |
633648
| device-01 full chain certificate | *certs/device-01-full-chain.cert.pem* | Presented by the device to authenticate and register with DPS. |
634649
| device-02 private key | *private/device-02.key.pem* | Used by the device to verify ownership of the device certificate during authentication with DPS. |
635-
| device-02 full chain certificate | *certs/device-01-full-chain.cert.pem* | Presented by the device to authenticate and register with DPS. |
650+
| device-02 full chain certificate | *certs/device-02-full-chain.cert.pem* | Presented by the device to authenticate and register with DPS. |
636651
637652
## Verify ownership of the root certificate
638653

0 commit comments

Comments
 (0)