在 Vertx 和 Java 中使用 CRL 处理证书吊销

Certificate Revocation handling with CRL in Vertx and Java

我将 Vertx v3.4.1 与 vertx-rx-java 一起使用到 运行 我的服务器。我必须启用基于证书的身份验证(相互身份验证),因此尝试在服务器端处理证书吊销检查。

我正在尝试使用 addCrlPath method of HttpServerOptions。但是,看起来,即使已加载的 CRL 已过期,它也不会从给定的 'path' 或证书的 CRL 分发点 (CDP) 重新加载 CRL。我找不到任何关于如何使用 Vertx 以编程方式实现它的 API/documentation。

我查看了 getTrustMgrFactory method in SSLHelper class 的实现,感觉它会选择仅在服务器启动时提供的 CRL。

所以,我的查询是:

  1. 我是否遗漏了一些配置,以确保在当前加载的 CRL 过期后自动从 CDP 下载最新的 CRL?
  2. 如果不是自动从 CDP 下载,是否有任何其他配置可以从 addCrlPath 方法中提供的相同路径重新加载 CRL?
  3. 如果 Vertx 中没有对 #​​1 和 #2 的内置支持,是否还有其他 API 提供此类内置支持?

否则我唯一的选择就是自己处理这些。

下面是我初始化服务器的代码

import io.vertx.core.http.ClientAuth;
import io.vertx.core.http.HttpServerOptions;
import io.vertx.core.net.PfxOptions;
import io.vertx.rxjava.core.Vertx;
import io.vertx.rxjava.ext.web.Router;
import io.vertx.rxjava.ext.web.RoutingContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class VertxServer {

private static final Logger LOGGER = LoggerFactory.getLogger(VertxServer.class);

private Vertx vertx;

public VertxServer(final Vertx v) {
    this.vertx = v;
}

public void init() {
    vertx.createHttpServer(getHttpServerOptions())
             // getRouter() method handles router configuration.
            .requestHandler(req -> getRouter().accept(req))
            .rxListen()
            .doOnSuccess(server -> LOGGER.info("Started listening to server..."))
            .doOnError(e -> LOGGER.error("Unable to listen. Server launch failed", e))
            .subscribe(
                    server -> LOGGER.info("Server launched successfully. {}", server),
                    e -> LOGGER.error("Server launch failed", e))
    ;
}

private HttpServerOptions getHttpServerOptions() {
    HttpServerOptions options = new HttpServerOptions()
            .setHost("127.0.0.1")
            .setPort(8085);
            .setSsl(true)
            .setPfxKeyCertOptions(
                    new PfxOptions()
                            .setPath("E:\temp\certs\server.pfx")
                            .setPassword("servercertpass".toCharArray())
            )

    setTrustStoreOptions(options);
    return options;
}

private void setTrustStoreOptions(final HttpServerOptions options) {
    PfxOptions pfxOptions = new PfxOptions()
           .setPath("E:\temp\certs\client-cert-root.p12")
           .setPassword("clientcertrootpass".toCharArray());
    options.setPfxTrustOptions(pfxOptions)
           .addCrlPath("E:\temp\certs\crls\client-certs.crl")
           .setClientAuth(ClientAuth.REQUEST);
}

  // Other methods here, which are not relevant for this question.
}

在编写此查询时,Vertx 中不存在重新加载 CRL 的选项。根据 Vertx google group discussion,它需要一些改进。此功能可能在实施相应更改后可用。