Azure / azure-iot-sdk-node

A Node.js SDK for connecting devices to Microsoft Azure IoT services
https://docs.microsoft.com/en-us/azure/iot-hub/
Other
262 stars 227 forks source link

[Bug]: error RSA PRIVATE KEY not found from while creating test certificate. #1150

Closed VishalEvoqua closed 1 year ago

VishalEvoqua commented 1 year ago

Done All the required process for the project setup (ex-NPM install , Open SLL install and other required steps)

But when I try to create the root certificate for provisioning x509 device (ie---create_test_cert.js root "TestRootCertificate") , I'm getting this error in the beginning it self so not able to execute other steps

Can you please suggest any way to resolve this issue ,I will be very grateful.

Could not create certificate: RSA PRIVATE KEY not found from openssl output: ---stdout--- -----BEGIN PRIVATE KEY----- MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC+IU1q7xyd2XLL yWSCKqpjUpeLxlaSVfyszpwbXulAL5PVyaTA827K4sFEyeTS1CijASK9IqVCdK1d /Ujje7MTdXHc1hjvPHRmogYHjOBxfXBKP990LWWgdRQ7WES/LjvB/O3nqmYdbeZw DNbZGo8mAzqKbz3Lc14cvcMCGy7vd4aaoIwyPP7Hcxmv3ALLMgQgBUpCQ1uvNpoG AftA4Ily9o0osHVX4GkisMEJ5lj4LqUpqL/CGyvrZfjXNmfSuelcirGActWWQR4e ZJzAnL9ununf2R88qe0ySQuIYq4w1j6VlmqYvYayscvkgv6vd+/cSa47a25JEuXs oy4JM+yfAgMBAAECgf8Z1DN3U3Y6bTOAe78PRS5ST+YNpTly4K1WWrsTNbUk5qcS R4tTHNtiCd3Fz+B+/IxP0YJYaEALHHlUZ9timjKAx5AiGrrWqNGZH78HR43gwJuA lyzEDWbA89F2d05txtoegFpDOv9PAC1N7xtA1OkPQO9BNIYwjyZWT3EugrvBIXgT GdHPLoQbhevE9CwDJcbmH+u69j8WuRkF6zqKvSnbv9GLDS7eRQykh69gv82mN3Qu Ccidwp5KXsE9u+qfjW4zVvI6QrA83qYD/9ucfAQINUZ1wvNn27n1z5GIR3dI7/Gh y+WrVAMCZggTrdoouTxrQ+e/zzn/FsfkljtdXYECgYEA/Zb227FC1ZYofX5+62le zLoUpotryZnrrO/XOzfX9JJGIOr1LOkhRzCuCqbQ/mCdJUCx+SEnLADl+Mt+sK1e A+RXBM1F4B5t7v+Ie/umB6ZgulhefPTad2TC214xbDDUbPxgpw7yDPuhUOV4T8io aNv6IKqhBgNdA36+IQcstd8CgYEAv+/tiRakV1G3/3VaQIa7acPnVXIvQY6QtbPl 1FyyatubFQcSW9W9SQfrCNqR+ZngE3vVgtViUver1RruK+2P2JDLikM9Hfdlmxu5 49bkMsDerxwQjjzyeZetpQ0NSHr+f7VLOShxZt9kbAvN3ROlXD07/YKIVhJQeDyR hmmYIUECgYEAoeB7ZpRKEKPQ5wMXq9jQjil+wy2eucuKmRNlNkUYkuPI5nx105xi BNq7Tstb//XWepBIy7pxEfLk2qO0FL4mlJ9vOP58S2vBS15NVq+2NY3skyeT8Xov 9yUYCgafz+t/vq6AWEP/GXCLcmN5IJz7fCxoB/BD592/w1plrhmxXcsCgYAXWDQ4 30Mfx7WsYXaXsIts4sHpN5kdzRw2rWm/uYKN0qX7GcAW4VlDX64rhoIIrLl/RSmD 3zY1RyBkLAFZ4GwFeB75cxIk6ek2w1mJp6Jbte+ftrcgxbLsLRGWqI68CRGZMNC0 ZAHe9D6/kXP5dqE/Jcd9Hvo8FcApz5wXkBJLwQKBgQCzFwXcyF4WJzsCsfyopgIu 6VF4zUkXCqMlUHpYSO2srTZ5PSXzryADZ+Bncl3RtoJnf1zgzkAxek+wZYFmi96n XmdeAg5CycGees58zWPWAR0HKAsIFUZe5WJWSl+btaW/vuea86q+ZDT2arhF1JuT s5L79qyX2IV/ZQ0PgbKTqA== -----END PRIVATE KEY-----

---stderr---

code: 0

anthonyvercolano commented 1 year ago
npm install  

added 56 packages, and audited 57 packages in 448ms

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
➜  tools git:(disconnect-error-event-fix) create_test_cert.js root "TestRootCertificate"
zsh: command not found: create_test_cert.js
➜  tools git:(disconnect-error-event-fix) node create_test_cert.js root "TestRootCertificate"
creating certificate with common name=TestRootCertificate
saving cert to testRootCertificate_cert.pem.
saving key to testRootCertificate_key.pem.
saving cert with chain to testRootCertificate_fullchain.pem.
PFX created with default password

Perhaps you didn't install openssl correctly? You didn't say what os you're using. What node you're using. What version of OpenSSL you're using.

Have you tried googling/binging the error message you got? This really looks like an openssl issue NOT the SDK.

VishalEvoqua commented 1 year ago

Right now using :-- os -- windows OpenSSL version --- 3.0.5 5 node-Version --- 16.17.0

anthonyvercolano commented 1 year ago

@VishalEvoqua Ok, your problem shows up if I run on my windows box. I've put an issue into the pem package at github.com/Dexus/pem/issues/346

See what comes of that.

anthonyvercolano commented 1 year ago

@VishalEvoqua You might consider upvoting Issue 346 and Issue 316

Have you tried this with OpenSSL 2.x?

anthonyvercolano commented 1 year ago

@VishalEvoqua I would recommend going back to openssl 1.1.1q. I installed this on my windows machine and the program runs again. Going to close this?

anthonyvercolano commented 1 year ago

closing due to inactivity