From e43abfeb02e803b9ee1ea627c835a9ce24c68fa7 Mon Sep 17 00:00:00 2001 From: ewertons Date: Tue, 14 Jul 2020 17:36:19 -0700 Subject: [PATCH] [iot] Fix generate_certificate.cmd, affected by samples reorg (#926) The documentation got modified previosly by 2d589c9ec0607c29e3344cfd4f5dab8d2725e6f0 --- .../iot/hub/src/generate_certificate.cmd | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/sdk/samples/iot/hub/src/generate_certificate.cmd b/sdk/samples/iot/hub/src/generate_certificate.cmd index d64fc06f96e..774e1170ab9 100644 --- a/sdk/samples/iot/hub/src/generate_certificate.cmd +++ b/sdk/samples/iot/hub/src/generate_certificate.cmd @@ -1,50 +1,50 @@ @REM Copyright (c) Microsoft Corporation. All rights reserved. -@REM SPDX-License-Identifier MIT +@REM SPDX-License-Identifier: MIT @echo off openssl ecparam -out device_ec_key.pem -name prime256v1 -genkey IF %ERRORLEVEL% NEQ 0 ( - echo Failed generating certificate key - exit b 1 + echo "Failed generating certificate key" + exit /b 1 ) -openssl req -new -days 365 -nodes -x509 -key device_ec_key.pem -out device_ec_cert.pem -config x509_config.cfg -subj CN=paho-sample-device1 +openssl req -new -days 365 -nodes -x509 -key device_ec_key.pem -out device_ec_cert.pem -config x509_config.cfg -subj "/CN=paho-sample-device1" IF %ERRORLEVEL% NEQ 0 ( - echo Failed generating certificate - exit b 1 + echo "Failed generating certificate" + exit /b 1 ) openssl x509 -noout -text -in device_ec_cert.pem -type device_ec_cert.pem device_cert_store.pem -type device_ec_key.pem device_cert_store.pem +type device_ec_cert.pem > device_cert_store.pem +type device_ec_key.pem >> device_cert_store.pem echo. -echo It is NOT recommended to use OpenSSL on Windows or OSX. Recommended TLS stacks are -echo Microsoft Windows SChannel httpsdocs.microsoft.comen-uswindowswin32comschannel +echo It is NOT recommended to use OpenSSL on Windows or OSX. Recommended TLS stacks are: +echo Microsoft Windows SChannel: https://docs.microsoft.com/en-us/windows/win32/com/schannel echo OR -echo Apple Secure Transport httpsdeveloper.apple.comdocumentationsecuritysecure_transport +echo Apple Secure Transport : https://developer.apple.com/documentation/security/secure_transport echo If using OpenSSL, it is recommended to use the OpenSSL Trusted CA store configured on your system. echo. -echo If required (for example on Windows), download the Baltimore PEM CA from httpswww.digicert.comdigicert-root-certificates.htm to the current folder. -echo Once it is downloaded, run the following command to set the environment variable for the samples +echo If required (for example on Windows), download the Baltimore PEM CA from https://www.digicert.com/digicert-root-certificates.htm to the current folder. +echo Once it is downloaded, run the following command to set the environment variable for the samples: echo. -echo set AZ_IOT_DEVICE_X509_TRUST_PEM_FILE=%CD%BaltimoreCyberTrustRoot.crt.pem +echo set "AZ_IOT_DEVICE_X509_TRUST_PEM_FILE=%CD%\BaltimoreCyberTrustRoot.crt.pem" echo. echo Sample certificate generated -echo Use the following command to set the environment variable for the samples +echo Use the following command to set the environment variable for the samples: echo. -echo set AZ_IOT_DEVICE_X509_CERT_PEM_FILE=%CD%device_cert_store.pem +echo set "AZ_IOT_DEVICE_X509_CERT_PEM_FILE=%CD%\device_cert_store.pem" echo. -echo Use the following fingerprint when creating your device in IoT Hub +echo Use the following fingerprint when creating your device in IoT Hub: -FOR F tokens= %%a in ('openssl x509 -noout -fingerprint -in device_ec_cert.pem') do SET output=%%a -set fingerprint=%output=% +FOR /F "tokens=*" %%a in ('openssl x509 -noout -fingerprint -in device_ec_cert.pem') do SET output=%%a +set fingerprint=%output::=% echo %fingerprint% -echo %fingerprint% fingerprint.txt +echo %fingerprint% > fingerprint.txt echo. -echo The fingerprint has also been placed in fingerprint.txt for future reference \ No newline at end of file +echo The fingerprint has also been placed in fingerprint.txt for future reference