Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if X509Certificate is CA certificate?

I have a X509Certificate instance in Java and I need to identify if it is a CA certificate or user certificate.

Can anyone provide any help?

Thanks in advance!

like image 985
Jurica Krizanic Avatar asked Aug 23 '12 13:08

Jurica Krizanic


People also ask

How do you identify a root CA?

We can differentiate a root certificate from an intermediate one by looking at the certificate itself. If the Issued to and Issued by fields are same then it is a root certificate, otherwise it is an intermediate. Another identification would be to look at the Certification Path.

How can I validate CA?

To verify a certificate, a browser will obtain a sequence of certificates, each one having signed the next certificate in the sequence, connecting the signing CA's root to the server's certificate. This sequence of certificates is called a certification path.

What is CA certificates CRT?

ca. crt is the CA's public certificate file. Users, servers, and clients will use this certificate to verify that they are part of the same web of trust. Every user and server that uses your CA will need to have a copy of this file.

How can I get CA certificate file?

Log on to Root Certification Authority Web Enrollment Site. ip_address = Root Certification Authority Server IP. fqdn = Fully qualified domain name of the Root Certification Authority Server. Select Download a CA certificate, certificate chain, or CRL.


1 Answers

According to research I have performed, it can be checked by checking basic constraints! Check the API for returning results of getBasicConstraints() method.

So if the method returns result != -1, a certificate can be considered as a CA certificate.

I have checked this with several CA certificates (root and intermediate), and it works as described. I have also checked this method with several user certificates, and the method returns -1 as result.

like image 108
Jurica Krizanic Avatar answered Sep 20 '22 19:09

Jurica Krizanic