Skip to content

Instantly share code, notes, and snippets.

@hoat23
Last active October 8, 2020 21:24
Show Gist options
  • Save hoat23/f71d081d06c3667f61106784f0c4ea8e to your computer and use it in GitHub Desktop.
Save hoat23/f71d081d06c3667f61106784f0c4ea8e to your computer and use it in GitHub Desktop.
# Generate private key
openssl genrsa [-des3] -out CA.key 2048
# Generate public key
openssl rsa -in CA.key -pubout -out CA.PUBLIC.key
# Generate a certificate
openssl req -new -x509 -days 1826 -key CA.key -out CA.crt
# Create a server key
openssl genrsa -out SERVER.key 2048
# Create a certificate request
openssl req -new -key SERVER.key -out SERVER.csr
# Sign the certificate request
sudo openssl x509 -req -in SERVER.csr -CA CA.crt -CAkey CA.key -CAcreateserial -out SERVER.crt -days 360
# Review
- CA.key -> CA.crt
- SERVER.key -> SERVER.csr -> SERVER.crt
# In broker just copy:
- CA.crt
- SERVER.key
- SERVER.crt
@hoat23
Copy link
Author

hoat23 commented Oct 8, 2020

Create certificates by broker mqtt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment