Get a Pentest and security assessment of your IT network.

Cyber Security

Verify Data with a CA: Best Practices

TL;DR

This guide shows you how to check if data is trustworthy by verifying it against a Certificate Authority (CA). We’ll cover checking certificates, using tools like OpenSSL, and understanding common errors. This helps protect your systems from malicious attacks.

1. Understanding Certificates & CAs

A digital certificate confirms the identity of a website or service. A CA is a trusted organisation that issues these certificates. When you connect to a secure website (HTTPS), your browser checks the website’s certificate against a list of trusted CAs.

  • Root Certificates: These are at the top of the trust chain and pre-installed in operating systems and browsers.
  • Intermediate Certificates: CAs often use intermediate certificates to sign end-entity (website) certificates.
  • End-Entity Certificates: The certificate presented by a website or service.

2. Checking the Certificate Chain

You need to verify that the entire chain of trust is valid – from the end-entity certificate back to a trusted root CA.

  1. Using Your Browser: Most browsers provide an easy way to view the certificate chain.
    • Chrome/Edge: Click the padlock icon in the address bar > Connection is secure > Certificate.
    • Firefox: Click the padlock icon > More Information > View Certificate.

    Examine each certificate in the chain to ensure it’s issued by a trusted authority and hasn’t expired.

  2. Using OpenSSL (Command Line): OpenSSL is a powerful tool for working with certificates.
    openssl s_client -showcerts <website address>:443

    This command will display the certificate chain sent by the server. Look for lines like Issuer: and Subject: to verify the issuing authority and the website’s identity.

3. Verifying Certificate Revocation

Certificates can be revoked if they are compromised. You need to check if a certificate has been revoked.

  1. Certificate Revocation Lists (CRLs): CAs publish CRLs containing revoked certificates.
    openssl crl2pkcs7 -nocrl -certfile <certificate file> | openssl pkcs7 -print_certs

    This command can help you examine the certificate and identify if it’s on a CRL (though this is less common now).

  2. Online Certificate Status Protocol (OCSP): OCSP provides real-time revocation status.
    openssl ocsp -i <certificate file> -url <OCSP URL from certificate>

    The OCSP URL is found within the certificate itself. A successful response indicates the certificate is still valid.

4. Common Errors and Troubleshooting

  • Certificate Not Trusted: The root CA isn’t in your trust store. Update your operating system or browser.
  • Expired Certificate: The certificate has passed its validity date. Contact the website owner to request a new certificate.
  • Hostname Mismatch: The certificate is issued for a different domain name than the one you’re connecting to. Check the URL carefully.
  • Revoked Certificate: The certificate has been revoked by the CA. Do not trust the connection.

5. Automated Verification

For automated systems, consider using libraries or tools that handle certificate verification for you.

  • Programming Languages: Most languages (Python, Java, etc.) have built-in SSL/TLS libraries with automatic CA validation.
  • Dedicated Libraries: Libraries like OpenSSL provide APIs for programmatic certificate checking.
Related posts
Cyber Security

Zip Codes & PII: Are They Personal Data?

Cyber Security

Zero-Day Vulnerabilities: User Defence Guide

Cyber Security

Zero Knowledge Voting with Trusted Server

Cyber Security

ZeroNet: 51% Attack Risks & Mitigation