Verify server certificate with the CA

There might be use case where you need to verify that the server certificate is actually signed by a particular CA :

Eg. You have a private CA server and you are having issues with the server certificate signed by that CA.

Lets test google.com

Now concatenate both GTS Root R1 and GTS CA 1c3 cert to one file eg. GTSRootR1.cer

Now export the *.google.com

(Note: all are in PEM format).

openssl verify -verbose -CAfile GTSRootR1.cer google.cer 
google.cer: OK

For invalid cert you will get something like below

openssl verify -verbose -CAfile RootR1.cer google.cer 
CN = *.google.com
error 20 at 0 depth lookup:unable to get local issuer certificate
google.cer: verification failed: 20 (unable to get local issuer certificate)