question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[OS X] can't connect: error importing private key with OSStatus -25257 / failed to import certificate and private key with error 1038

See original GitHub issue

Known Issue

  • I’m using ATS data type endpoint: the endpoint should look like <prefix>-ats.iot.<region>.amazonaws.com

Platform/OS/Hardware/Device What are you running the sdk on?

Mac OS X 10.15 on GitHub Actions

Describe the question When trying to connect using the connection cannot be established. These errors are printed:

Error:  [2021-09-01T11:40:25Z] [0000000110907dc0] [pki-utils] - static: error importing private key with OSStatus -25257
113
Error:  [2021-09-01T11:40:25Z] [0000000110907dc0] [tls-handler] - static: failed to import certificate and private key with error 1038.

This happens in a project where we run the same tests on Ubuntu and Mac OS using GitHub actions. The Ubuntu configuration works.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
coderbyheartcommented, Sep 1, 2021

Using an RSA key I see a different error:

   ℹ  IoT (cert) Generating key for device <deviceId> ⏱ +3ms
   ℹ  IoT (cert) openssl genrsa -out device.key 2048 ⏱ +0ms
   ℹ  IoT (cert) Generating CSR for device <deviceId> ⏱ +91ms
   ℹ  IoT (cert) openssl req -new -key device.key -out device.csr -subj /CN=<deviceId> ⏱ +0ms
   ℹ  IoT (cert) Generating certificate for device <deviceId> ⏱ +14ms
   ℹ  IoT (cert) openssl x509 -req -in device.csr -CAkey rootCA.key -CA rootCA.pem -CAcreateserial -out device.pem -days 1 -sha256 ⏱ +0ms
   ℹ  step I connect the tracker "{agpsDevice}" ⏱ +32ms
   ℹ  IoT > connect Connecting <deviceId> to xxx-ats.iot.eu-west-1.amazonaws.com ... ⏱ +4ms

Error:  [2021-09-01T18:04:42Z] [0000700004e25000] [socket] - id=0x7fdee5e8d470 fd=26: connect failed with error code 65.
Error:  [2021-09-01T18:04:42Z] [0000700004e25000] [channel-bootstrap] - id=0x7fdee2c50de0: failed to create socket with error 1049
Error:  [2021-09-01T18:04:43Z] [0000700004e25000] [tls-handler] - id=0x7fdee5cbdd70: error reported during SSLRead. OSStatus code -9805

CrtError: Failed to connect: libaws-c-mqtt: AWS_ERROR_MQTT_UNEXPECTED_HANGUP, The connection was closed unexpectedly.
Failed to connect.
    at /Users/runner/work/asset-tracker-cloud-aws-js/asset-tracker-cloud-aws-js/node_modules/aws-crt/dist/native/mqtt.js:333:36
    at processTicksAndRejections (node:internal/process/task_queues:78:11) {
  error: 'Failed to connect: libaws-c-mqtt: AWS_ERROR_MQTT_UNEXPECTED_HANGUP, The connection was closed unexpectedly.',
  error_code: undefined,
  error_name: undefined
}
Failed to connect: libaws-c-mqtt: AWS_ERROR_MQTT_UNEXPECTED_HANGUP, The connection was closed unexpectedly.
1reaction
bretambrosecommented, Sep 1, 2021

Well if you can use an RSA one temporarily, I’ll see if we can’t get ecc key import bumped in priority. It bugs me that it’s not supported but I’d need to get someone else to do it since I don’t have a Mac.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error -25294 | Apple Developer Forums
Create a new user account on your Mac (using System Preferences > Users & Groups). Log in is that account. Try to import...
Read more >
macos - Can't import public key into OSX Keychain - Super User
But the Public Key can't be imported. Instead I get the following error message: An error has occurred. Unable to import an item....
Read more >
An error has occurred. Unable to import an item. The contents ...
When you request a certificate, your Mac creates a public/private pair that will be used to download the certificate from Apple.
Read more >
Can't import SSL private key certificate - Internet Information ...
An internal error occurred. This can be either the user profile is not accessible or the private key that you are importing might...
Read more >
Framework - OSStatus — Apple API Errors
Framework. All; Kernel; Security Error Name Error Code Kernel SecBasePrivate.h errSecACLNotSimple ‑25240 Kernel SecBasePrivate.h errSecBufferTooSmall ‑25301 Kernel SecBasePrivate.h errSecCreateChainFailed ‑25318
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found