openssl

OpenSSL is an open-source cryptography toolkit implementing the SSL and TLS network protocols and the related cryptography standards required by them. It is a command-line tool for using the various cryptography functions of OpenSSL’s crypto-library from the shell. OpenSSL can be used for the creation and management of private keys, public keys, and parameters; public-key cryptographic operations; creation of x509 certificates, CSRs, and CRLs; etc.

table of contents
LIST
FROM [[]]
WHERE parent = this.file.link

Docs

  1. OpenSSL - Calculating Digest Value
  2. OpenSSL - Generating PSK
  3. OpenSSL - Installation
  4. generation
  5. OpenSSL - get fingerprint from certificate
  6. openssl - get certificate from URL
  7. openssl - Common Algorithms
  8. openssl - file encryption

Flags

Flag Description
-new, -X509 Generates self signed root CA
-subj CA Identity
-des3 Triple DES
-nocerts Only Private key in output
-nodes No DES
-clcerts get client certificates
-nokeys only certificates in output

Generation of x509 certificates

View certificate information

openssl x509 \
  --in server.crt \
  -text \
  --noout

View p7b chain

openssl pkcs7 -in yourfile.p7b -print_certs -noout

PEM file

openssl x509 -in server.pem -noout -text

Converting to PEM file from CRT and KEY

openssl x509 -inform DER -outform PEM -in server.crt -out server.crt.pem
cat server.crt server.key > server.includesprivatekey.pem

Debugging

openssl s_client -connect localhost:8081

Reference

  1. How to create a .pem file for SSL Certificate Installations | Support | SUSE

Generating Fullchain certificate

OpenSSL create certificate chain with Root & Intermediate CA | GoLinuxCloud

Private key to pem

openssl rsa -in server.key -text > privatekey.pem

P12/PFX to P7B

openssl pkcs12 -in yourfile.pfx -out yourfile.pem -nodes
openssl crl2pkcs7 -nocrl -certfile yourfile.pem -out yourfile.p7b

P12/PFX to CRT

openssl pkcs12 -in $PFX -clcerts -nokeys -out $CRT
openssl x509 -inform DER -in subca_class_2.cer -out subca_class_2.crt
openssl x509 -inform DER -in SUST_Class_3_VDS_e-Seal_named_curve.cer -out SUST_Class_3_VDS_e-Seal_named_curve.crt

Installation in ios - forums

Reading public keys

Format wars

xcode linker flags

-lcrypto
-L/opt/homebrew/opt/[email protected]/lib

Build Settings > Search Path

/opt/homebrew/opt/[email protected]/include/openssl

Create PFX from CRT and Key

openssl pkcs12 -export -out tls.pfx -inkey tls.key -in tls.crt
openssl x509 -outform der -in cert.pem -out tls.cer
openssl x509 -inform der -in tls.cer -out tls.crt

(From Here)

Concat full chain

https://gist.github.com/singhabhinav/132b8196abac026b43fa

P12 to CER

openssl pkcs12 -in ca-client.p12 -clcerts -nokeys -out ca-client.cer