java - The publicKey should not be null when trying to PGP encrypt in Mule -


i'm trying pgp encrypt message using mule, i'm getting "publickey should not null" error.

i replaced local_policy.jar , us_export_policy.jar here: c:\program files\java\jdk1.7.0_45\jre\lib\security

in library have: bcpg-jdk15on-150.jar. added local_policy.jar (not sure need tried , without , got same error).

i'm running mulestudio 3.5 , ce-3.4 runtime.

<?xml version="1.0" encoding="utf-8"?>  <mule xmlns:json="http://www.mulesoft.org/schema/mule/json" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:pgp="http://www.mulesoft.org/schema/mule/pgp" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="ce-3.4.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core     http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd http://www.mulesoft.org/schema/mule/jms     http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd http://www.mulesoft.org/schema/mule/pgp     http://www.mulesoft.org/schema/mule/pgp/current/mule-pgp.xsd http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd"> <jms:activemq-connector name="active_mq" specification="1.1" username="removed" password="removed" brokerurl="tcp://127.0.0.1:61613" validateconnections="true" doc:name="active mq"/> <spring:beans>     <spring:bean id="pgpkeymanager" class="org.mule.module.pgp.pgpkeyringimpl" init-method="initialise">         <spring:property name="publickeyringfilename" value="pubring.gpg"/>         <spring:property name="secretkeyringfilename" value="secring.gpg"/>         <spring:property name="secretaliasid" value="-2461745123444227218"/>         <spring:property name="secretpassphrase" value="removed"/>     </spring:bean>     <spring:bean id="credentialaccessor" class="org.mule.security.muleheadercredentialsaccessor"/> </spring:beans>  <pgp:security-manager>     <pgp:security-provider name="pgpsecurityprovider" keymanager-ref="pgpkeymanager" />     <pgp:keybased-encryption-strategy name="keybasedencryptionstrategy" keymanager-ref="pgpkeymanager" credentialsaccessor-ref="credentialaccessor" /> </pgp:security-manager>  <flow name="activemq_password_encryptionflow1" doc:name="activemq_password_encryptionflow1">     <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8082" doc:name="http"/>     <encrypt-transformer strategy-ref="keybasedencryptionstrategy" />     <jms:outbound-endpoint queue="test" connector-ref="active_mq" doc:name="jms"/>     <echo-component doc:name="echo"/> </flow> 

here's error:

info  2014-03-10 14:44:04,480 [[activemq_password_encryption].connector.http.mule.default.receiver.02] org.mule.component.simple.logcomponent:  ******************************************************************************** * message received in service: activemq_password_encryptionflow1. content is:  * * '/helloworld2'                                                               * ******************************************************************************** error 2014-03-10 14:44:04,489 [[activemq_password_encryption].connector.http.mule.default.receiver.02] org.mule.exception.defaultmessagingexceptionstrategy:  ******************************************************************************** message               : crypto failure code                  : mule_error-111 -------------------------------------------------------------------------------- exception stack is: 1. publickey should not null (java.lang.illegalargumentexception)   org.apache.commons.lang.validate:203 (null) 2. crypto failure (org.mule.api.security.cryptofailureexception)   org.mule.module.pgp.keybasedencryptionstrategy:65 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/security/cryptofailureexception.html) -------------------------------------------------------------------------------- root exception stack trace: java.lang.illegalargumentexception: publickey should not null     @ org.apache.commons.lang.validate.notnull(validate.java:203)     @ org.mule.module.pgp.encryptstreamtransformer.<init>(encryptstreamtransformer.java:46)     @ org.mule.module.pgp.keybasedencryptionstrategy.encrypt(keybasedencryptionstrategy.java:60)     + 3 more (set debug level logging or '-dmule.verbose.exceptions=true' everything) ******************************************************************************** 

the exception occurs since using muleheadercredentialsaccessor , have not set header mule_user or set value not match uid in keyring.

either have set header (inbound property) or implement own credentialsaccessor returns correct credentials.

you can find code muleheadercredentialsaccessor , on this page there simple example credentialsaccessor returns hard coded credential.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -