Find out if a certificate is self-signed or CA-signed


Nishan:

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

I am running a java web application on tomcat and can use openssl.

Sarnold:

Edit: There are two better answers to this question today:

However, I think there are more important things to address - why do people want to know about self-signed certificates. What is the goal? What's the problem? In most cases, trying to separate certificates into self-signed and non-self-signed piles is probably the wrong approach. A better approach is almost certainly to verify that any given certificate has a valid signature chain from a trusted certificate authority and that any connections associated with the given certificate match that certificate.

Here is the rest of my original answer. This is probably not what you want.


It's a bit hacky, but the openssl x509command can report publishers and topics. If the subject and issuer are the same, it is self-signed; if they are different, it is signed by the CA. (Strictly speaking, many self-signed certificates are also signed by the CA itself.)

While testing this theory, I ran some tests. It runs something like:

cd /etc/ssl/certs
for f in *.0 ; do openssl x509 -in $f -issuer | head -1 > /tmp/$f.issuer ; openssl x509 -in $f -subject | head -1 > /tmp/$f.subject ; done
 cd /tmp
 sed -i -e s/issuer=// *.issuer
 sed -i -e s/subject=// *.subject
 cd /etc/ssl/certs/
 for f in *.0 ; do diff -u /tmp/$f.issuer /tmp/$f.subject ; done

Hope this helps.

Related


Find out if a certificate is self-signed or CA-signed

Nishan: I have a web application that allows users to upload pkcs12. I store pkcs12 as binary in database. Is there any way for me to know if the certificate in pkcs12 is self signed or CA signed? I am running a java web application on tomcat and can use opens

Find out if a certificate is self-signed or CA-signed

Nishan: I have a web application that allows users to upload pkcs12. I store pkcs12 as binary in database. Is there any way for me to know if the certificate in pkcs12 is self signed or CA signed? I am running a java web application on tomcat and can use opens

Self-signed certificate with CA

Jawad-Dev: I am working on a solution for file encryption via a combination of RSA and AES. RSA is basically used here for a handshake to encrypt a symmetric key and decrypt with the key pair at the receiver side. I have used Java keystore for private key and

Self-signed certificate with CA

Jawad-Dev: I am working on a solution for file encryption via a combination of RSA and AES. RSA is basically used here for a handshake to encrypt a symmetric key and decrypt with the key pair at the receiver side. I have used Java keystore for private key and

Self-signed certificate with CA

Jawad-Dev: I am working on a solution for file encryption via a combination of RSA and AES. RSA is basically used here for a handshake to encrypt a symmetric key and decrypt with the key pair at the receiver side. I have used Java keystore for private key and

Self-signed certificate with CA

Jawad-Dev: I am working on a solution for file encryption via a combination of RSA and AES. RSA is basically used here for a handshake to encrypt a symmetric key and decrypt with the key pair at the receiver side. I have used Java keystore for private key and

Trusted CA on self-signed certificate

horny I have an old Linux based embedded device from a project about ten years ago. The device has no built-in UI, keyboard or anything like that, just a small web server to control it. I have since forgotten the passcode on the device and the company that ori

Trusted CA on self-signed certificate

horny I have an old Linux based embedded device from a project about ten years ago. The device has no built-in UI, keyboard or anything like that, just a small web server to control it. I have since forgotten the passcode on the device and the company that ori

Invalid CA certificate with self-signed certificate chain

Tejas I have a self signed certificate chain with these commands and configured it on the Apache server but when i tryopenssl s_client -showcerts -servername server -connect my-host.local:443 -CAfile all.crt I am getting error from opensslVerify return code: 2

Invalid CA certificate with self-signed certificate chain

Tejas I have a self signed certificate chain with these commands and configured it on the Apache server but when i tryopenssl s_client -showcerts -servername server -connect my-host.local:443 -CAfile all.crt I am getting error from opensslVerify return code: 2

Self-signed certificate: Connection timed out

Smogu I have a web application (Apache 2.4 on Centos 7 server) with restricted user access and I use self signed certificates with client certificates (mutual authentication) for each user. everything is normal. The user is successfully authenticated, and sinc

Self-signed certificate: Connection timed out

Smogu I have a web application (Apache 2.4 on Centos 7 server) with restricted user access and I use self signed certificates with client certificates (mutual authentication) for each user. everything is normal. The user is successfully authenticated, and sinc

Self-signed certificate: Connection timed out

Smogu I have a web application (Apache 2.4 on a Centos 7 server) with restricted user access and I use self-signed certificates (mutual authentication) with client certificates for each user. everything is normal. The user is successfully authenticated, and si

Self-signed certificate: Connection timed out

Smogu I have a web application (Apache 2.4 on a Centos 7 server) with restricted user access and I use self-signed certificates (mutual authentication) with client certificates for each user. everything is normal. The user is successfully authenticated, and si

OpenSSL Self-Signed Root CA Certificate: Set Start Date

Kampar I'm using the following setup (using OpenSSL 1.0.1 14 Mar 2012) to create a small test CA with my own self signed certificate. The problem I'm having is that if I look at the start date of the CA's own certificate, it will create it for tomorrow (and I

Using self signed CA certificate for WebSocket (ws) in Node JS

Thomas Shankartis I need to connect to a separate WebSocket server using a ws client in Node JS . Since I have a "Self-Signed Root CA" installed in my computer's "Trusted Root Certification Authorities" store, I can connect using the sample program in Chrome.

C# Generate intermediate certificate from self signed root CA

username I am using Visual Studio 2019 with c# and Bouncy Castlein version 1.8.5. I have been able to generate Certificate Authority(CA) successfully and now want to generate one Intermediate Certificate. In the current workflow, the CA certificate is returned

C# Generate intermediate certificate from self signed root CA

username I am using Visual Studio 2019 with c# and Bouncy Castlein version 1.8.5. I have been able to generate Certificate Authority(CA) successfully and now want to generate one Intermediate Certificate. In the current workflow, the CA certificate is returned

OpenSSL Self-Signed Root CA Certificate: Set Start Date

Kampar I'm using the following setup (using OpenSSL 1.0.1 14 Mar 2012) to create a small test CA with my own self signed certificate. The problem I'm having is that if I look at the start date of the CA's own certificate, it will create it for tomorrow (and I

Generate self-signed certificate with root CA signer

Ninja Ninja Scenario: I'm using PowerShell on Windows Server 2012r2 to generate a root certificate and want to use it to sign newly created intermediate and web certificates in a dynamically generated (and destroyed) dev/test environment. The scripts are deplo

Generate self-signed certificate with root CA signer

Ninja Ninja Scenario: I'm using PowerShell on Windows Server 2012r2 to generate a root certificate and want to use it to sign newly created intermediate and web certificates in a dynamically generated (and destroyed) dev/test environment. The scripts are deplo

Self-signed certificate doesn't work - invalid CA

it Using openssl I am trying to install a ssl certificate on my server using Apache. Follow some links like this youtube tutorial . I was able to download/install openSSL running the following commands openssl genrsa -aes256 -out private.key 2048 openssl rsa -

Using self signed CA certificate for WebSocket (ws) in Node JS

Thomas Shankartis I need to connect to a separate WebSocket server using a ws client in Node JS . Since I have a "Self-Signed Root CA" installed in my computer's "Trusted Root Certification Authorities" store, I can connect using the sample program in Chrome.

Using self signed CA certificate for WebSocket (ws) in Node JS

Thomas Shankartis I need to connect to a separate WebSocket server using a ws client in Node JS . Since I have a "Self-Signed Root CA" installed in my computer's "Trusted Root Certification Authorities" store, I can connect using the sample program in Chrome.

How to trust a self-signed certificate without trusting a CA?

SeMeKh So, I've generated the rootCA, and signed the certificate for *.a.com, how can I trust the generated certificate in Firefox/Chrome without directly trusting the CA? Note that adding an exception (once) is not enough in this case because there are multip

C# Generate intermediate certificate from self signed root CA

username I am using Visual Studio 2019 with c# and Bouncy Castlein version 1.8.5. I have been able to generate Certificate Authority(CA) successfully and now want to generate one Intermediate Certificate. In the current workflow, the CA certificate is returned

OpenSSL Self-Signed Root CA Certificate: Set Start Date

Kampar I'm using the following setup (using OpenSSL 1.0.1 14 Mar 2012) to create a small test CA with my own self signed certificate. My problem is that if I look at the start date of the CA's own certificate, it will create that certificate for tomorrow (and

Windows Tomcat7 SSL CA certificate says self signed

crush Hi, I'm trying to configure tomcat7 (7.0.50) in Windows 7 with a certificate from a CA (trust, if that matters). I downloaded the CA root, chain root and chain certificate files and the new certificate. According to the tomcat guide , I used the keystore