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!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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 aCA 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.