如何在java中提取X509Certificate的有效性?
我可以使用 checkValidility() 方法检查 X509Certificate 证书的有效性,但我的项目要求还从 X509Certificate 日期中提取日期和日期的有效性并存储在数据库中。
但 API 中没有返回这些日期的方法。
所以,请帮助我提取这些值。提前致谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有API方法。 X509Certificate getNotBefore() 和 getNotAfter()方法应该返回这些日期。
There are API methods. The X509Certificate getNotBefore() and getNotAfter() methods should return those dates.
我找到了问题的答案,API 确实提供了返回这些日期的方法:
x509Certificate.getNotAfter()
- 验证日期。x509Certificate.getNotBefore()
- 在日期之前验证。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.