Hi,
I followed this post https://forums.openmv.io/t/mqtt-connection-to-aws-iot-core/1464
to connect to AWS MQTT.
I understand that the keys and cert must be binary (DER) instead of PEM
I have manage to convert the cert in DER with openssl but failed to convert the private key form PEM to DER
I’m using the following openssl command
openssl x509 -outform der -in *****-certificate.pem.crt -out *******-certificate.der
for the cert and
openssl x509 -outform der -in *********-private.pem.key -out ********-private.key.der
for the key.
Openssl sprit out the following error message for the key
Expecting: TRUSTED CERTIFICATE
Does any one manage to convert the private key from pem to der?
My micropyhton code to connect mqtt through TLS is:
KEY_PATH = "6336c81ec8-public.pem.key"
CERT_PATH = "6336c81ec8-certificate.der"
with open(KEY_PATH, 'r') as f:
key1 = f.read()
with open(CERT_PATH, 'r') as f:
cert1 = f.read()
client = MQTTClient(client_id="esp32",
server="aeyd89uk69eiz-ats.iot.us-east-2.amazonaws.com",
port=8883,
keepalive=4000,
ssl=True,
ssl_params={ "key":key1, "cert":cert1, "server_side":False })
client.connect()
print ("MQTT client conencted")