我正在使用Vertx v3.4.1和Vertx rx java来运行我的服务器。我必须启用基于证书的身份验证(相互身份验证),因此尝试在服务器端处理证书吊销检查。
我正在尝试使用
addCrlPath method of HttpServerOptions
. 然而,看起来它不会从给定的“路径”或证书的CRL分发点(CDP)重新加载CRL,即使已经加载的CRL已过期。我找不到任何关于如何使用Vertx编程实现它的API/文档。
我看了一下
getTrustMgrFactory method in SSLHelper class
因此,我的问题是:
-
我是否缺少一些配置来确保当前加载的CRL过期后自动从CDP下载最新的CRL?
-
addCrlPath
方法
-
如果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.
}