gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 14:37:32 24 4
gpt4 key购买 nike

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

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

我查看了 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.
}

最佳答案

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

关于java - 在 Vertx 和 Java 中使用 CRL 处理证书吊销,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46359146/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com