[英]Certificate Revocation handling with CRL in Vertx and Java
我將Vertx v3.4.1與vertx-rx-java一起使用來運行服務器。 我必須啟用基於證書的身份驗證(相互身份驗證),因此嘗試在服務器端處理證書吊銷檢查。
我正在嘗試使用HttpServerOptions的addCrlPath方法 。 但是,看起來,即使已加載的CRL過期,它也不會從給定的“路徑”或證書的CRL分發點(CDP)重新加載CRL。 我找不到任何有關如何使用Vertx以編程方式實現它的API /文檔。
我看過SSLHelper類中getTrustMgrFactory方法的實現,並且感覺到它將選擇僅在服務器啟動時提供的CRL。
因此,我的查詢是:
addCrlPath
方法中提供的相同路徑重新加載CRL? 否則,我唯一的選擇就是親自處理這些問題。
下面是我如何初始化服務器的代碼
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谷歌小組討論 ,這需要一些改進。 實施相應更改后,此功能可能可用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.