2011-07-08 31 views
-1

連接到https服務器我用這個命令將.pem文件轉換爲.jks一個(source):如何用騾子2

keytool -importcert -alias debian -file cert.pem -keystore cert.jks -storepass passwd 

這裏是騾子文件:

<?xml version="1.0" encoding="UTF-8"?> 
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:http="http://www.mulesource.org/schema/mule/http/2.2" 
    xmlns:https="http://www.mulesource.org/schema/mule/https/2.2" 
    xsi:schemaLocation=" 
     http://www.mulesource.org/schema/mule/http/2.2 http://www.mulesource.org/schema/mule/http/2.2/mule-http.xsd 
     http://www.mulesource.org/schema/mule/https/2.2 http://www.mulesource.org/schema/mule/https/2.2/mule-https.xsd 
     http://www.mulesource.org/schema/mule/core/2.2 http://www.mulesource.org/schema/mule/core/2.2/mule.xsd"> 

    <https:connector name="SslConnector" keepSendSocketOpen="true"> 
     <https:tls-client path="${mule.home}/cert.jks" 
          storePassword="passwd"/> 
    </https:connector> 

    <model> 
     <service name="ConnectToHTTPS"> 
      <inbound> 
       <http:inbound-endpoint host="localhost" 
             port="9000" 
             synchronous="true"/> 
      </inbound> 
      <outbound> 
       <chaining-router> 
        <outbound-endpoint address="https://localhost" 
             synchronous="true"/> 
       </chaining-router> 
      </outbound> 
     </service> 
    </model> 
</mule> 

現在,我得到這個:

ERROR 2011-07-08 12:06:51,210 [main] org.mule.MuleServer: 
******************************************************************************** 
Message    : Initialisation Failure: Error creating bean with name 'SslConnector': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: The Key password cannot be null 
Type     : org.mule.api.lifecycle.InitialisationException 
Code     : MULE_ERROR-72085 
JavaDoc    : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/lifecycle/InitialisationException.html 
Object    : [email protected] 
******************************************************************************** 
Exception stack is: 
1. The Key password cannot be null (java.lang.IllegalArgumentException) 
    org.mule.api.security.tls.TlsConfiguration:290 (null) 
2. Error creating bean with name 'SslConnector': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: The Key password cannot be null (org.springframework.beans.factory.BeanCreationException) 
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory:1338 (null) 
3. Initialisation Failure: Error creating bean with name 'SslConnector': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: The Key password cannot be null (org.mule.api.lifecycle.InitialisationException) 
    org.mule.registry.AbstractRegistry:76 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/api/lifecycle/InitialisationException.html) 

阿里納斯:這擴展在Is there a way to connect to https server by specifying only the url in Mule 2?

回答

2

經過試驗你的配置後,我覺得還需要一個tls-key-store元素。

下HTTPS配置允許「ConnectToHTTPS」成功擊中HTTPS出站目標:

<https:connector name="SslConnector" keepSendSocketOpen="true"> 
    <https:tls-client path="${mule.home}/cert.jks" 
         storePassword="passwd"/> 
    <https:tls-key-store path="${mule.home}/cert.jks" 
         keyPassword="passwd" 
         storePassword="passwd" /> 
</https:connector> 
+0

我得到'無法找到有效的認證路徑要求的目標...'。這是否意味着我將不得不訪問私人證書? – Tshepang

+0

不,我嘗試了一個公共證書,該證書是從我通過HTTPS瀏覽的網站檢索到的。 –

+0

您是否需要將它從'.pem'格式轉換成?如果是這樣,你使用了什麼命令? – Tshepang