Skip to content

SSL Error: SSL PEM lib #276

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Shivam-Kukreja opened this issue Jan 16, 2021 · 3 comments
Closed

SSL Error: SSL PEM lib #276

Shivam-Kukreja opened this issue Jan 16, 2021 · 3 comments
Assignees
Labels
guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@Shivam-Kukreja
Copy link

Platform/OS/Hardware/Device: Windows 10
Python Version: 3.7
SSL Version: OpenSSL 1.1.1d 10 Sep 2019

I am trying to connect to AWS IOT using X.509 certificate authentication but I am getting SSL Exception in PEM lib and not able to figure out what's going wrong have done the initialization and configuration as per the documentation.
I am using ats endpoint.

Client Initialization:
myAWSIoTMQTTClient = AWSIoTMQTTClient(CLIENT_ID)
myAWSIoTMQTTClient.configureEndpoint(ENDPOINT, 8883)
myAWSIoTMQTTClient.configureCredentials(PATH_TO_ROOT, PATH_TO_KEY, PATH_TO_CERT)
myAWSIoTMQTTClient.connect()
print("mqtt client connection successful")

Traceback:
in connect_aws_iot_client
myAWSIoTMQTTClient.connect()
File "C:\Users\shivamkukreja\AppData\Local\Programs\Python\Python37\lib\site-packages\AWSIoTPythonSDK\MQTTLib.py", line 355, in connect
return self._mqttCore.connect(keepAliveIntervalSecond)
File "C:\Users\shivamkukreja\AppData\Local\Programs\Python\Python37\lib\site-packages\AWSIoTPythonSDK\core\protocol\mqttCore.py", line 282, in connect
self._pahoClient.connect(self._host, self._port, keepAliveInterval) # Throw exception...
File "C:\Users\shivamkukreja\AppData\Local\Programs\Python\Python37\lib\site-packages\AWSIoTPythonSDK\core\protocol\paho\client.py", line 655, in connect
return self.reconnect()
File "C:\Users\shivamkukreja\AppData\Local\Programs\Python\Python37\lib\site-packages\AWSIoTPythonSDK\core\protocol\paho\client.py", line 798, in reconnect
ciphers=self._tls_ciphers)
File "C:\Users\shivamkukreja\AppData\Local\Programs\Python\Python37\lib\ssl.py", line 1232, in wrap_socket
context.load_cert_chain(certfile, keyfile)
Exception: [SSL] PEM lib (_ssl.c:3901)

Please help.

@jmklix jmklix self-assigned this Jan 19, 2021
@jmklix jmklix added the guidance Question that needs advice or information. label Jan 19, 2021
@jmklix
Copy link
Member

jmklix commented Jan 19, 2021

How did you generate your certificate? There is a similar error where the solution was that the private key was not correct.

@jmklix jmklix added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jan 19, 2021
@Shivam-Kukreja
Copy link
Author

Yes my private key was incorrect I was just saving the key only in the file, was missing Begin and End Private key lines in the file("-----BEGIN RSA PRIVATE KEY-----")

Thanks for the help.

@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information. response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants