我使用此命令将.pem
文件转换为.jks
个文件(source):
keytool -importcert -alias debian -file cert.pem -keystore cert.jks -storepass passwd
这是Mule文件:
<?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 : org.mule.config.spring.SpringRegistry@160bf50
********************************************************************************
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?
答案 0 :(得分: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>