【发布时间】:2019-08-15 17:32:15
【问题描述】:
在 Java 11 中是否有一些快速的“声明性”方式,而不是繁琐的手动实现来检查证书是否被吊销?
我尝试使用此答案中的属性: Check X509 certificate revocation status in Spring-Security before authenticating 使用此虚拟吊销证书:https://revoked.badssl.com 但代码始终接受证书。我是在做错什么,还是这些属性对于 Java 11 不再实际?如果是这样,我们还有其他选择吗?
下面是我的代码:
public static void validateOnCertificateRevocation(boolean check) {
if (check) {
System.setProperty("com.sun.net.ssl.checkRevocation", "true");
System.setProperty("com.sun.security.enableCRLDP", "true");
Security.setProperty("ocsp.enable", "true");
}
try {
new URL("https://revoked.badssl.com").openConnection().connect();
} catch (IOException e) {
e.printStackTrace();
}
}
【问题讨论】:
标签: ssl ssl-certificate java-11 certificate-revocation