Apache Camel,客户端证书

时间:2013-05-29 20:53:38

标签: java xml spring apache-camel

我正在尝试通过Apache Camel找到一种优雅的方式来附加客户端证书。它可以是Java或Spring XML。

我发送给所有服务器的服务器都有服务器证书,可以加密流量,但我需要在发送之前将客户端公共证书附加到邮件中。服务器包含15个左右的证书及其对应的私钥。

我的主要配置是用Spring XML编写的,所以我不知道如何使用添加客户端证书。

(我是一个拥有最少java和0 Linux经验的.NET人员)

样本春天:

<camel:route>          
    <camel:from uri="direct:GetEligibility"/>
    <camel:doTry>                   
        <camel:choice>
            <camel:when>
                <camel:xpath>count(//soapenv:Envelope) = '0'</camel:xpath>
                <camel:to uri="xslt:xslt/WrapSoap.xsl"/>
            </camel:when>
        </camel:choice>   
        <camel:setHeader headerName="CamelHttpMethod">
            <camel:constant>POST</camel:constant>
        </camel:setHeader>

        <camel:setHeader headerName="Content-Type">
            <camel:constant>text/xml; charset=utf-8</camel:constant>
        </camel:setHeader>     

        <camel:to uri="https://testsite.gov.ca/Services.Secured/FICR_AR022001.asmx"/>        

        <camel:doCatch>
            <camel:exception>java.lang.Exception</camel:exception>
            <camel:bean ref="log" method="error"/>
        </camel:doCatch>
    </camel:doTry>                
</camel:route>    

1 个答案:

答案 0 :(得分:1)

您需要预先配置一组SSLContextParameters,然后才能将您想要的任何证书添加到http端点。您可以选择使用不同的证书路由到不同的端点。

在Camel docs here中描述了它: