Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find if a certificate is self signed or CA signed

Tags:

I have a web app, which allows user to upload pkcs12. I store the pkcs12 as binary in database. Is there any way for me to know if the certificate in the pkcs12 is self signed or CA signed?

I am running a Java web app on tomcat and have openssl at my disposal.

like image 309
Nishan Avatar asked Apr 25 '12 03:04

Nishan


People also ask

How do I find the issuer of a certificate?

The steps to view the certificate information depend on the browser. For instance, in Google Chrome, click on the lock icon in the address bar, switch to the the Connection tab and click on Certificate Information . Search for the issuer organization name.

How do I check a signing certificate?

In Chrome, go to Settings. On the Settings page, below Default browser, click Show advanced settings. Under HTTPS/SSL, click Manage certificates. In the Certificates window, on the Personal tab, double-click the code signing certificate that you just installed.


1 Answers

Following email thread precisely tells the right way to verify if the base64 encoded certificate (i.e. PEM) is self signed or not: http://marc.info/?l=openssl-users&m=116177485311662&w=4

Following is the code snippet:

openssl verify -CAfile self_signed_cert.pem self_signed_cert.pem 

should return:

self_signed_cert.pem: OK 

OR compare the issuer and subject. If they are same, it is self signed

openssl x509 -in cert.pem -inform PEM -noout -subject -issuer 
like image 163
NitinB Avatar answered Oct 20 '22 08:10

NitinB