Chethan kumar
Chethan kumar

Reputation: 221

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.

Upvotes: 13

Views: 11043

Answers (2)

Chethan kumar
Chethan kumar

Reputation: 221

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.

Upvotes: 3

Patrick
Patrick

Reputation: 2122

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

Upvotes: 24

Related Questions