Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to extract Validity To and From X509Certificate in java?

I am able to check for the validity of the X509Certificate certificate using the checkValidility() method, But my project requirement is also to extract validity to and from dates also from the X509Certificate date and store in the database.

But there are no methods in the API which returns these dates.

So, please help me in extracting these values. Thanks in Advance.

like image 600
Chethan kumar Avatar asked Feb 08 '12 14:02

Chethan kumar


2 Answers

There are API methods. The X509Certificate getNotBefore() and getNotAfter() methods should return those dates.

like image 195
Patrick Avatar answered Oct 25 '22 04:10

Patrick


I found the answer for my Question , API does provide methods to return these dates:

x509Certificate.getNotAfter() - Validate To Date.

x509Certificate.getNotBefore() - Validate Before Date.

like image 39
Chethan kumar Avatar answered Oct 25 '22 03:10

Chethan kumar