簡體   English   中英

安全LDAP-使用Java中的指紋驗證證書

[英]Secure LDAP - validating certificate using thumbprint in java

我正在嘗試通過SSL連接到ldap server

我正在使用spring ldap模板,並具有一個自定義SSL Socket工廠。

我的要求是使用指紋(而不是使用Java密鑰庫)來驗證證書

我將在數據庫中擁有指紋信息,並且需要使用服務器的證書指紋來進行驗證。

您需要創建一個實現X509TrustManager的自定義TrustManager ,並讀取證書以提取“縮略圖”並將其與(不確定該值)進行比較。

然后,您需要在設置SSLContext時使用,例如:

TrustManager[] tms =
        { new com.willeke.security.FakeX509TrustManager() };
        SSLContext context = null;
        try
        {
            context = SSLContext.getInstance("TLS", "SunJSSE");
            /**
             * The first parameter - null means use the default key manager. The desired TrustManager The third parameter - null means use the default value secure random".
             */
            context.init(null, tms, null);
        }
        catch (... ex)
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM