| Back | Main view

Manual verification of commit log revocation data and certificate chain using OpenSSL

Product:IMiS/ARChive
Release:All
Date:02/12/2021

Case: When signed document is saved on IMiS ARChive server and server is configured to check document signature, commit log is created with verification result. Based on server configuration commit log may contain signature status, certificate chain and revocation data. Here we present an example of manual verification of revocation data and certificate chain in commit log.

Description:

Certificate chain validation:

Certificates are located between <iarc:x509 iarc:valuetype="1"> and </iarc:x509> xml tags and are PEM encoded X509 certificates. Each certificate must be extracted, before it can be used for verification (with header and footer). From extracted certificates, CA certificates must be put in certificate authority chain so that they can be used in verification process as trusted certificates. One way to do this is that each certificate is decoded and displayed with next command:

openssl x509 -in extracted_certificate.pem -text -noout

If certificate is flagged as "CA" (X509v3 extensions, basic constraints), then it is a candidate for certificate authority chain. Example of decoded and printed "CA" flagged certificate:

X509v3 extensions:
    1.3.6.1.4.1.311.20.2:
        ...C.A
    X509v3 Key Usage:
        Digital Signature, Certificate Sign, CRL Sign
    X509v3 Basic Constraints: critical
        CA:TRUE
    X509v3 Subject Key Identifier:
        B3:56:26:DB:E0:6A:9C:58:76:00:68:F6:BE:5C:DA:E4:96:3D:40:17

Using textual matching of subject/issuer also help building certificate chain. When trusted certificates are distinguished from verification certificate, certificate authority chain can be created. One method is using "cat" command:

cat extracted_certificate_1.pem extracted_certificate_2.pem > ca_chain.pem

Verification certificate can be validated against certificate chain with next command:

openssl verify -CAfile ca_chain.pem verifying_certificate.pem



Online certificate status protocol (OCSP) response validation:

OCSP response is base64 encoded binary data, which is located between <iarc:ocsp iarc:valuetype="2"> and </iarc:ocsp> xml tags. Data must be extracted and decoded to binary format before it can be validated. If extracted data is multiline, then decoding can be done with:

openssl enc -d -base64 -in ocsp_multiline.txt -out ocsp_multiline_decoded.bin

If extracted data is in single line, use -A options:

openssl enc -d -A -base64 -in ocsp_one_line.txt -out ocsp_one_line.bin

WARNING: Using -A options on base64 multiline data will result in error and decoded binary file size will be 0 bytes. Decoded OCSP can be displayed with next command:

openssl ocsp -respin ocsp_decoded.bin -text -noverify

Part of decoded OCSP response which confirms that certificate with serial number 1C000002442FEE33BA1CBD532C000000000244 is valid:

OCSP Response Data:
    OCSP Response Status: successful (0x0)
    Response Type: Basic OCSP Response
    Version: 1 (0x0)
    Responder Id: E96746F913C2EB27AE4F8B5245B632B5352C4F71
    Produced At: Feb  2 12:46:43 2021 GMT
    Responses:
    Certificate ID:
      Hash Algorithm: sha1
      Issuer Name Hash: 7DDA7E324241ACEFDAEB1007DB8179017C78C0DB
      Issuer Key Hash: 11DFDD174FFB0C9A3690AFC86CD17D03ACEABB41
      Serial Number: 1C000002442FEE33BA1CBD532C000000000244
    Cert Status: good
    This Update: Feb  2 11:50:02 2021 GMT
    Next Update: Feb  4 16:58:02 2021 GMT

OCSP can be validated automatically with next command:

openssl ocsp -noverify -respin ocsp_decoded.bin -issuer issuer_certificate.pem -cert verifying_certificate.pem

Full automatic verification (including certificate chain verification) can be done with next command:

openssl ocsp -CAfile ca_chain.pem -respin ocsp_decoded.bin -issuer issuer_certificate.pem -cert verifying_certificate.pem



Certificate revocation list (CRL) validation:

Certificate revocation list is located between <iarc:crl iarc:valuetype="2"> and </iarc:crl> xml tags. Data between tags is PEM encoded and must be extracted before it can be validated (including header and footer). CRL can be decoded and displayed with next command:

openssl crl -inform PEM -text -noout -in extracted_crl.pem

For automatic verification, verification bundle must be built. Verification bundle is built from CA certificates and certificate revocation lists, which will be included in verification process. Combine all CA and CRL from commit log and run next command:

openssl verify -crl_check -CAfile verification_bundle.pem verifying_certificate.pem

Related Documents:

https://www.openssl.org/docs/man1.0.2/man1/ocsp.html
https://www.openssl.org/docs/man1.0.2/man1/crl.html
https://www.openssl.org/docs/man1.0.2/man1/x509.html

| Back | Main view