dumber mtls cert management. Inspired by certstrap
A command-line utility for creating and managing X.509 certificates with secure keychain storage for sensitive data.
- Create CA (Certificate Authority) certificates
- Generate server certificates
- Add and remove client certificates
- Generate secure passphrases for client certificates
- PFX (PKCS#12) format support for client certificates
- Secure storage of certificates and passwords in system keychain
- Certificate and password retrieval capabilities
mtlshed create \
--output-dir ./certs \
--server-cn server.example.com \
--client-names client1 client2 \
--word-list-file wordlist.txtmtlshed add \
--output-dir ./certs \
--client-names newclient \
--client-passwords "optional-password"mtlshed remove \
--output-dir ./certs \
--client-names client1mtlshed list \
--output-dir ./certsmtlshed info \
--output-dir ./certs \
--name client1mtlshed get-password \
--name client1mtlshed export \
--name client1 \
--public-key recipient.pub \
--output client1.encExports client certificate data encrypted with recipient's public key.
mtlshed decrypt \
--private-key recipient.key \
--input client1.encThe decrypt command:
- Takes an encrypted certificate file
- Uses the corresponding private key to decrypt
- Displays the decrypted certificate details:
- Certificate data
- Private key
- Certificate password
- Asymmetric encryption using RSA-OAEP with SHA256
- Only the holder of the private key can decrypt
- Secure transfer of client certificates
- Complete certificate data including private keys and passwords
- Keep the private key secure
- The private key must match the public key used for encryption
- Encrypted files are base64 encoded for easy transfer
- Decrypted data includes all necessary information to use the certificate
The utility uses the system's native keychain (Keychain Access on macOS) to securely store:
- Client certificate private keys
- Certificate data
- Client certificate passwords
Each certificate entry in the keychain contains:
{
"private_key": "PEM-encoded private key",
"certificate": "PEM-encoded certificate",
"password": "certificate password"
}- Python 3.x
- cryptography library
- keyring library (for keychain access)
pip install cryptography keyring- Secure storage using system keychain
- Encrypted storage of private keys
- Password-protected client certificates
- Automatic master key management
- Access control through system keychain
- Store CA private keys securely
- Use strong passphrases for client certificates
- Keep certificate files in a secure location
- System keychain provides additional security layer
- Access to stored credentials requires system authentication