You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by ckalirasa <ck...@yahoo.com> on 2012/09/06 17:51:30 UTC

does Camel support PGP Encryption?

Hi:
I am new to Camel.  Just wondering wheather camel support PGP
encryption/decryption?
Is there any example I can see camel route encrypt/decrypt?
Thanks
Chandra



--
View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: does Camel support PGP Encryption?

Posted by ckalirasa <ck...@yahoo.com>.
its working.
Thank you.



--
View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723p5719060.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: does Camel support PGP Encryption?

Posted by aedwards <ad...@middleware360.com>.
Can you post your exact classpath, directory structure, command you are using
to initiate and current working directory.

Have you considered using the maven java-exec plugin to avoid having to
manually configure your classpaths.  It works really well.

http://mojo.codehaus.org/exec-maven-plugin/usage.html




--
View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723p5718847.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: does Camel support PGP Encryption?

Posted by ckalirasa <ck...@yahoo.com>.
No, I ran the sample code provided by Camel in Action (chapter1-file-copy)
with slight modification:

In the pom.xml:

              <dependency>
		<groupId>org.apache.camel</groupId>
		<artifactId>camel-crypto</artifactId>
		<version>${camel-version}</version>
	</dependency>    

--------------------------------------------

public class FileCopierWithCamel {

    public static void main(String args[]) throws Exception {
        // create CamelContext
        CamelContext context = new DefaultCamelContext();

        // add our route to the CamelContext
        context.addRoutes(new RouteBuilder() {
            public void configure() {
                from("file:data/inbox?noop=true")
                .marshal().pgp("pubring.gpg","")
               
.to("file:data/outbox?fileName=${date:now:yyyyMMdd-hh:mm:ss}.pdf.PGP");
            }
        });

        // start the route and let it do its work
        context.start();
        Thread.sleep(10000);

        // stop the CamelContext
        context.stop();
    }
}

I've already set the classpath to 'pubring.gpg' and now I m getting
different error:

*java.io.FileNotFoundException: Cannot find resource in classpath for URI:
pubring.gpg*
	at
org.apache.camel.util.ResourceHelper.resolveMandatoryResourceAsInputStream(ResourceHelper.java:92)[camel-core-2.10.0.jar:2.10.0]
	at
org.apache.camel.converter.crypto.PGPDataFormatUtil.findPublicKey(PGPDataFormatUtil.java:51)[camel-crypto-2.10.0.jar:2.10.0]



--
View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723p5718814.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: does Camel support PGP Encryption?

Posted by James Carman <ja...@carmanconsulting.com>.
Sorry, didn't see that you were already using the built-in PGP
support.  Did you try running the test cases here:

http://svn.apache.org/repos/asf/camel/trunk/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/

I'd say start there and modify it to suit your needs.

On Thu, Sep 6, 2012 at 10:12 PM, James Carman
<ja...@carmanconsulting.com> wrote:
> Have you tried using bouncycastle as your JCE provider?  It supports PGP.
>
> On Thu, Sep 6, 2012 at 4:33 PM, ckalirasa <ck...@yahoo.com> wrote:
>> The error I was getting :
>>
>> java.lang.IllegalArgumentException: Public key is null, cannot proceed
>>         at
>> org.apache.camel.converter.crypto.PGPDataFormat.marshal(PGPDataFormat.java:66)[camel-crypto-2.10.0.jar:2.10.0]
>>         at
>> org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:59)[camel-core-2.10.0.jar:2.10.0]
>>
>> Eventhough the 'pubring.gpg' contains publick key.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723p5718735.html
>> Sent from the Camel Development mailing list archive at Nabble.com.

Re: does Camel support PGP Encryption?

Posted by James Carman <ja...@carmanconsulting.com>.
Have you tried using bouncycastle as your JCE provider?  It supports PGP.

On Thu, Sep 6, 2012 at 4:33 PM, ckalirasa <ck...@yahoo.com> wrote:
> The error I was getting :
>
> java.lang.IllegalArgumentException: Public key is null, cannot proceed
>         at
> org.apache.camel.converter.crypto.PGPDataFormat.marshal(PGPDataFormat.java:66)[camel-crypto-2.10.0.jar:2.10.0]
>         at
> org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:59)[camel-core-2.10.0.jar:2.10.0]
>
> Eventhough the 'pubring.gpg' contains publick key.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723p5718735.html
> Sent from the Camel Development mailing list archive at Nabble.com.

Re: does Camel support PGP Encryption?

Posted by ckalirasa <ck...@yahoo.com>.
The error I was getting :

java.lang.IllegalArgumentException: Public key is null, cannot proceed
	at
org.apache.camel.converter.crypto.PGPDataFormat.marshal(PGPDataFormat.java:66)[camel-crypto-2.10.0.jar:2.10.0]
	at
org.apache.camel.processor.MarshalProcessor.process(MarshalProcessor.java:59)[camel-core-2.10.0.jar:2.10.0]

Eventhough the 'pubring.gpg' contains publick key.



--
View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723p5718735.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: does Camel support PGP Encryption?

Posted by ckalirasa <ck...@yahoo.com>.
Thanks David.
I've already set the class path for 'pubring.gpg', I am getting the
following exceptions:

Exception in thread "main" org.apache.camel.FailedToCreateRouteException:
Failed to create route route1 at: >>>
Marshal[org.apache.camel.model.dataformat.PGPDataFormat@7e346322] <<< in
route: Route[[From[direct:inline]] -> [Marshal[org.apache.camel.mod...
because of Data format 'pgp' could not be created. Ensure that the data
format is valid and the associated Camel component is present on the
classpath


Code:

  context.addRoutes(new RouteBuilder() {
            public void configure() {             

            	from("file:data/inbox")            	
            	.marshal().pgp("pubring.gpg", "Chandra")   	            
            	.to("file:data/outbox");     	

            	
            }
        });

Anything wrong with above code? 
Thanks




--
View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723p5718733.html
Sent from the Camel Development mailing list archive at Nabble.com.

Re: does Camel support PGP Encryption?

Posted by David Karlsen <da...@gmail.com>.
Yes, see:
http://camel.apache.org/crypto.html

2012/9/6 ckalirasa <ck...@yahoo.com>:
> Hi:
> I am new to Camel.  Just wondering wheather camel support PGP
> encryption/decryption?
> Is there any example I can see camel route encrypt/decrypt?
> Thanks
> Chandra
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/does-Camel-support-PGP-Encryption-tp5718723.html
> Sent from the Camel Development mailing list archive at Nabble.com.



-- 
--
David J. M. Karlsen - http://www.linkedin.com/in/davidkarlsen