【发布时间】:2013-12-06 19:51:35
【问题描述】:
我正在尝试使用私钥对 JMS 文本消息的有效负载进行签名。然后将消息发送到队列并进行相应的路由。签名将与公钥一起放置在消息头中。
我正在使用下面的代码来设置带有公钥的标题。
TextMessage textMessage = session.createTextMessage(message);
String publicKey = new String(pubk.getEncoded());
textMessage.setStringProperty("CamelSignaturePublicKeyOrCert", publicKey);
但是,当消息开始路由时,我收到以下错误
11:13:20,027 WARN [org.apache.camel.component.jms.EndpointMessageListener] JMS 消息侦听器执行失败。原因:[org.apache.camel.RuntimeCamelException - java.lang.IllegalStateException:无法验证签名,因为没有提供公钥或证书。在路由定义中提供一个或通过消息头“CamelSignaturePublicKeyOrCert”]:org.apache.camel.RuntimeCamelException:java.lang.IllegalStateException:无法验证签名,因为没有提供公钥或证书。在路由定义中提供一个或通过消息头 'CamelSignaturePublicKeyOrCert
路由定义如下
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<!-- Dependencies: ojdbc.jar and aqjms.jar must be in the activemq lib directory -->
<route>
<from uri="activemq:queue:queue.outbound"/>
<log message="The expected queue is :: ${headers.queue}" />
<to uri="crypto:verify://slpy" />
<choice>
<when>
<simple>${headers.queue} == 'ora'</simple>
<to uri="oracleQueue:queue:SLEEPY_LION_QUEUE"/>
</when>
<when>
<simple>${headers.queue} == 'proc'</simple>
<to uri="activemq:queue:queue.proc"/>
</when>
<otherwise>
<log message="Invalid queue"/>
</otherwise>
</choice>
</route>
【问题讨论】:
标签: java jms activemq apache-camel