keys

Root CA

[!TIP|label:Criteria]

  1. Subject == Issuer

  2. Basic Constraints == CA:TRUE

  3. Key Usage == Certificate Sign, CRL Sign

  4. No AKI ( Authority Key Identifier ) or AKI == SKI ( Subject Key Identifier )

$ key='Company Root CA.crt'

# subject == issuer
$ openssl x509 -in "${key}" -issuer -subject -noout
issuer=CN=Company Root CA V1
subject=CN=Company Root CA V

$ while read -r ext; do
    openssl x509 -in "${key}" -noout -ext "${ext}";
  done < <( xargs -n1 <<< "subjectKeyIdentifier authorityKeyIdentifier keyUsage basicConstraints")
X509v3 Subject Key Identifier:
    D4:1B:61:8A:74:67:B9:DC:B4:42:B9:72:AD:49:73:BD:CC:51:C7:08
No extensions in certificate                    # no AKI
X509v3 Key Usage:
    Digital Signature, Certificate Sign, CRL Sign
X509v3 Basic Constraints: critical
    CA:TRUE

Intermediate CA

check certificate chain

fetch cert file from chain

fetch the last certificate from chain ( root CA )

transform

TO
FROM
COMMAND

PEM

DER encoded binary X.509 (.CER)

$ openssl x509 -outform PEM -in <NAME>.cer -out <NAME>.pem -inform DER

PEM

Base-64 encoded X.509 (.CER)

$ openssl x509 -outform PEM -in <NAME>.cer -out <NAME>.pem -inform PEM

PEM

Cryptographic Message Syntax Standard PKCS #7 Certificates (.P7B)

$ openssl pkcs7 -outform PEM -in <NAME>.p7b -out <NAME>.pem -inform DER

TO
FROM
COMMAND

CRT

DER encoded binary X.509 (.CER)

$ openssl x509 -in <NAME>.cer -out <NAME>.crt -inform DER

CRT

Base-64 encoded X.509 (.CER)

$ openssl x509 -in <NAME>.cer -out <NAME>.crt -inform PEM

CRT

Cryptographic Message Syntax Standard PKCS #7 Certificates (.P7B)

$ openssl pkcs7 -in <NAME>.p7b -out <NAME>.crt -inform DER

TO
FROM
COMMAND

PEM

DER encoded binary X.509 (.CER)

$ openssl x509 -in <NAME>.crt -out <NAME>.pem -outform PEM -inform DER

PEM

Base-64 encoded X.509 (.CER)

$ openssl x509 -in <NAME>.crt -out <NAME>.pem -outform PEM -inform PEM

PEM

Cryptographic Message Syntax Standard PKCS #7 Certificates (.P7B)

$ openssl pkcs7 -in <NAME>.p7b -out <NAME>.pem -outform PEM -inform DER

tips

  • using base64 to convert DER to PEM format:

keys

KEYS
FORMAT

CRT

binary file

PEM

key type

KEY FORMAT
KEY TYPE
DETAILS

CRT

DER

PEM

P7B

DER

Last updated

Was this helpful?