I’ve created a rootCA.crt, client.crt and client.key for accessing my HiveMQ CE over port 8883.
Using MQTT.fx, the above mentioned files work correctly:
But the same files with MQTT CLI don’t work. MQTT CLI is running on WSL2>Debian. I get the error
mqtt> con -h broker.MYSERVER.xx -p 8883 -V 3 --verbose --secure --cafile /mnt/c/Users/XXXXX/Downloads/certs/rootCA.crt --cert /mnt/c/Users/XXXXX/Downloads/certs/Passwordless/client.crt --key /mnt/c/Users/XXXXX/Downloads/certs/Passwordless/client.key
Invalid value for option '--key': cannot convert '/mnt/c/Users/XXXXX/Downloads/certs/Passwordless/client.key' to PrivateKey (The private key could not be recognized.)
My client.key file begins/ends with -----BEGIN PRIVATE KEY-----
/ -----END PRIVATE KEY-----
.
For creating client.key I used the following command:
openssl req -new -newkey rsa:4096 -nodes -keyout client.key -out client.csr
Am I using a wrong/invalid format? How should I generate the private key for it to work with MQTT CLI?