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
Copy openssl genrsa -aes256 -out ca-key.pem 4096 Generate a public CA Cert
Copy openssl req -new -x509 -sha256 -days 3650 -key ca-key.pem -out ca.pem Optional Stage: View Certificate's Content
Copy openssl x509 -in ca.pem -text
openssl x509 -in ca.pem -purpose -noout -text Generate Certificate
Copy openssl genrsa -out cert-key.pem 4096 Create a Certificate Signing Request (CSR)
Copy openssl req -new -sha256 -subj " /CN=exploit.se " -key cert-key.pem -out cert.csr Create a extfile with all the alternative names
Copy echo " subjectAltName=DNS:exploit.se,IP:10.10.10.10 " >> extfile.cnf 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) .
openssl x509 -outform der -in cert.pem -out cert.der
openssl x509 -inform der -in cert.der -out cert.pem
openssl pkcs12 -in cert.pfx -out cert.pem -nodes
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 herearrow-up-right and here.arrow-up-right
Assuming the path to your generated CA certificate as C:\ca.pem, run:
Set -CertStoreLocation to Cert:\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 (classic System32 one) and adds a system-wide trust anchor.
The exact steps vary device-to-device, but here is a generalized guide:
Locate Encryption and Credentials section. It is generally found under Settings > Security > Encryption and Credentials
Choose Install a certificate
Locate the certificate file ca.pem on your SD Card/Internal Storage using the file manager.