How to verify a certificate on the command line
Certificate verification on the command line can be done using the openssl verify
command. Its documentation can be found on the openssl-verify
man page.
Let’s verify the leaf certificate that we have just generated. We will consider our root CA certificate a trusted certificate. Our intermediate CA certificate will be considered untrusted, but it will help us to build the certificate signing chain.
Here is how we can verify the leaf certificate on the command line:
$ openssl verify \ -verbose \ -show_chain \ -trusted root_cert.pem \ -untrusted intermediate_cert.pem \ leaf_cert.pem leaf_cert.pem: OK Chain: depth=0: CN = Leaf (untrusted) depth=1: CN = Intermediate CA (untrusted) depth=2: CN = Root CA
Note the -trusted
and -untrusted
switches. The -trusted
switch is used to specify a file containing...