SSL/TLS Certificates
X.509 is an ITU standard defining the format of public key certificates. X.509 are used in TLS/SSL, which is the basis for HTTPS. An X.509 certificate binds an identity to a public key using a digital signature. A certificate contains an identity (hostname, organization, etc.) and a public key (RSA, DSA, ECDSA, ed25519, etc.), and is either signed by a Certificate Authority or is Self-Signed.
Self-Signed Certificates
Generate CA
Generate RSA
Generate a public CA Cert
Optional Stage: View Certificate's Content
Generate Certificate
Create a RSA key
Create a Certificate Signing Request (CSR)
Create a
extfile
with all the alternative names
Create the certificate
Certificate Formats
X.509 Certificates exist in Base64 Formats PEM (.pem, .crt, .ca-bundle), PKCS#7 (.p7b, p7s) and Binary Formats DER (.der, .cer), PKCS#12 (.pfx, p12).
Convert Certs
openssl x509 -outform der -in cert.pem -out cert.der
PEM to DER
openssl x509 -inform der -in cert.der -out cert.pem
DER to PEM
openssl pkcs12 -in cert.pfx -out cert.pem -nodes
PFX to PEM
Verify Certificates
openssl verify -CAfile ca.pem -verbose cert.pem
Install the CA Cert as a trusted root CA
On Debian & Derivatives
Move the CA certificate (
ca.pem
) into/usr/local/share/ca-certificates/ca.crt
.Update the Cert Store with:
Refer the documentation here and here.
On Windows
Assuming the path to your generated CA certificate as C:\ca.pem
, run:
Set
-CertStoreLocation
toCert:\CurrentUser\Root
in case you want to trust certificates only for the logged in user.
OR
In Command Prompt, run:
certutil.exe
is a built-in tool (classicSystem32
one) and adds a system-wide trust anchor.
On Android
The exact steps vary device-to-device, but here is a generalized guide:
Open Phone Settings
Locate
Encryption and Credentials
section. It is generally found underSettings > Security > Encryption and Credentials
Choose
Install a certificate
Choose
CA Certificate
Locate the certificate file
ca.pem
on your SD Card/Internal Storage using the file manager.Select to load it.
Done!
Last updated