Skip to content

How to Verify an SSL Certificate with OpenSSL

DodaTech Updated 2026-06-24 2 min read

Certificate verification ensures that an SSL certificate is valid, trusted, and has not expired. This guide walks through the specific troubleshooting steps to diagnose and resolve certificate verification issues.

Before You Begin

Before you begin, be sure to have the following in place:

  • A Linux server with the relevant software installed
  • Access to the command line interface
  • Appropriate permissions (root or sudo)

Quick Fix

Wrong

openssl verify server.pem

Wrong: Verifying the leaf cert without providing the CA chain

openssl verify -CAfile ca-chain.pem -untrusted intermediate.pem server.pem

Right: Using -CAfile and -untrusted for full chain verification

Output

server.pem: OK

Prevention

To avoid future issues, follow these best practices:

  • Always provide the full CA chain when verifying leaf certificates
  • Use -CApath for directories containing multiple CA certificates in hashed format
  • Check certificate purpose with -purpose flag to ensure it is valid for the intended use
  • Verify the certificate chain order
  • Test production certificate chains with openssl s_client -showcerts

DodaTech Tools

For further assistance with any of the above issues, consider using DodaTech consulting services or DodaTech tutorials for more in-depth guidance.

Common Mistakes with cert verify

  1. Overlapping type class instances that cause GHC to reject the program with ambiguous dispatch errors
  2. Non-exhaustive pattern matches that compile with warnings then crash at runtime
  3. Misunderstanding that String is [Char] with poor performance for large text operations

These mistakes appear frequently in real-world OPENSSL code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

What does openssl verify: OK mean?|||It means the certificate chains to a trusted root in the provided CA store, has not expired, and passes basic X.509 validation rules including signature verification.
How do I verify a certificate against multiple CA certificates? Combine all CA certificates into a single file and use -CAfile bundle.pem, or place hashed CA certificates in a directory and use -CApath /etc/ssl/certs.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro