Why Use TLS/SSL?
Credential Protection
Encrypts username and password during authentication to prevent credential theft.
Data Privacy
Encrypts all MQTT messages in transit, protecting sensitive data from eavesdropping.
Broker Authentication
Verifies the broker’s identity to prevent man-in-the-middle attacks.
Client Authentication
Optionally authenticates clients using certificates for mutual TLS (mTLS).
Quick Start
Adjust Port
Change the port to your broker’s TLS port (typically
8883 for MQTT or 8443 for WebSocket).Configure Certificate Validation
- Keep Validate certificate enabled for production (verifies against system CAs)
- Disable for self-signed certificates in testing
TLS Configuration Options
Basic TLS Settings
Enable TLS/SSL encryption for the connection.When enabled:
- Connection uses TLS encryption (mqtts:// or wss://)
- Port typically changes to 8883 (MQTT) or 8443 (WebSocket)
- All data is encrypted in transit
Validate the broker’s certificate against trusted certificate authorities.When enabled (recommended for production):
- Verifies broker certificate is signed by a trusted CA
- Validates certificate hostname matches connection host
- Checks certificate expiration
- Prevents man-in-the-middle attacks
- Accepts self-signed certificates
- Accepts expired certificates
- Accepts hostname mismatches
- Bypasses CA validation
Certificate Types
MQTT Explorer supports three types of certificates for different security scenarios:Server Certificate (CA Certificate)
Server Certificate (CA Certificate)
A self-signed or custom CA certificate to verify the broker’s identity.When to use:
- Broker uses a self-signed certificate
- Broker uses a certificate from a private/internal CA
- Additional security by pinning the exact CA certificate
- Click Advanced → Certificates
- Upload Server Certificate (CA)
- Keep Validate certificate enabled
When you provide a CA certificate, MQTT Explorer trusts this specific CA in addition to system CAs.
Client Certificate (Mutual TLS)
Client Certificate (Mutual TLS)
A certificate that identifies this MQTT client to the broker.When to use:
- Broker requires client certificate authentication (mutual TLS/mTLS)
- Enhanced security with certificate-based client authentication
- IoT device authentication
- Click Advanced → Certificates
- Upload Client Certificate (public certificate)
- Upload Client Key (private key)
Client Key
Client Key
The private key corresponding to the client certificate.Requirements:
- Must match the client certificate
- Should not be password-protected (or decrypt first)
- PEM format only
- RSA (2048-bit or 4096-bit)
- Elliptic Curve (EC) keys
- Store keys securely with restricted file permissions
- Never commit keys to version control
- Use separate keys for each client
- Rotate keys periodically
Certificate Configuration
Uploading Certificates
Open Certificate Settings
In the connection dialog:
- Select your connection profile
- Click Advanced button
- Click Certificates button
Select Certificate File
For each certificate type:
- Click the file selection button
- Choose your PEM-format certificate file
- The certificate name and preview will appear
Verify Certificate
Check that:
- Certificate name is displayed correctly
- File size is reasonable (typically < 10KB)
- Certificate format is PEM (starts with
-----BEGIN CERTIFICATE-----)
Certificate Formats
MQTT Explorer accepts certificates in PEM format only. If your certificates are in a different format, convert them first:Common TLS Configurations
Public CA Certificate (Let’s Encrypt, DigiCert)
Example: Connecting to HiveMQ Cloud or other commercial brokers with public certificates.
Self-Signed Certificate
Upload CA (Option 2 - Recommended)
- Keep Validate certificate enabled
- Click Advanced → Certificates
- Upload your self-signed certificate as Server Certificate (CA)
- This validates against your specific certificate
Mutual TLS (mTLS)
For brokers requiring client certificate authentication:Enable TLS and Validation
- Toggle Encryption (tls) on
- Keep Validate certificate enabled
- Set port to
8883
Upload Client Certificate
Click Advanced → Certificates:
- Upload Client Certificate (your certificate)
- Upload Client Key (your private key)
Generating Self-Signed Certificates
For testing purposes, you can generate self-signed certificates:For production, use certificates from a trusted CA like Let’s Encrypt or your organization’s PKI infrastructure.
Browser Mode Considerations
When running MQTT Explorer in browser mode, certificate handling differs:WebSocket TLS (wss://)
Use
ws protocol for WebSocket connections (required in browser mode)- Non-encrypted:
ws://broker.example.com:8080 - TLS encrypted:
wss://broker.example.com:8443
wss://Certificate Limitations
Reverse Proxy Setup
For browser mode, use a reverse proxy to handle TLS:Troubleshooting
Certificate validation failed
Certificate validation failed
Symptoms: Connection fails with certificate verification errorCommon causes:
- Self-signed certificate without proper configuration
- Expired certificate
- Hostname mismatch
- Untrusted CA
- For testing: Disable certificate validation (not recommended for production)
- For production: Upload the CA certificate as “Server Certificate (CA)”
- Verify certificate:
- Check hostname: Ensure the hostname in your connection matches the certificate CN/SAN
Client certificate not working
Client certificate not working
Symptoms: Connection refused, authentication error with mTLSCommon causes:
- Client certificate and key don’t match
- Key is password-protected
- Certificate not signed by broker’s trusted CA
- Wrong certificate format
- Verify certificate and key match:
- Remove password from key:
- Check certificate chain: Ensure client cert is signed by CA trusted by broker
- Verify PEM format: Certificate should start with
-----BEGIN CERTIFICATE-----
Hostname mismatch error
Hostname mismatch error
Symptoms: “Hostname does not match certificate CN” errorCauses:
- Connecting via IP address but certificate is for hostname
- Certificate CN doesn’t match connection hostname
- Missing Subject Alternative Name (SAN) entries
- Use correct hostname: Connect using the name in the certificate
- Add SAN entries: Regenerate certificate with SAN:
- Disable validation: For testing only, disable certificate validation
Wrong certificate format
Wrong certificate format
Symptoms: “Invalid certificate” error, upload failsCauses:
- Certificate is not in PEM format
- File is corrupted or truncated
- File contains wrong data
- Verify PEM format:
- Convert from DER:
- Check file content: Ensure file starts with
-----BEGIN CERTIFICATE----- - Re-export certificate: Export from source and try again
TLS handshake timeout
TLS handshake timeout
Symptoms: Connection times out during TLS handshakeCauses:
- TLS version mismatch
- Cipher suite incompatibility
- Network/firewall blocking TLS traffic
- Broker not listening on TLS port
- Verify broker is listening:
- Check TLS version: Ensure broker supports TLS 1.2 or 1.3
- Firewall rules: Verify port 8883 is open
- Broker logs: Check for TLS errors
Security Best Practices
Always Use TLS in Production
Never transmit credentials or sensitive data over unencrypted connections.
Validate Certificates
Keep certificate validation enabled except for testing with self-signed certificates.
Use Strong Keys
Use 2048-bit or 4096-bit RSA keys, or 256-bit EC keys for adequate security.
Rotate Certificates
Renew certificates before expiration and rotate keys periodically (annually).
Secure Private Keys
Protect client private keys with file permissions (chmod 600) and never commit to version control.
Monitor Expiration
Set up alerts for certificate expiration at least 30 days in advance.
Next Steps
Authentication
Configure username/password authentication to work with your TLS setup.
Connection Setup
Learn about other connection configuration options.
Security Policy
Review MQTT Explorer’s complete security policy and best practices.
Environment Variables
Configure TLS settings using environment variables for server deployments.