You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Goyal, Arpit" <ar...@sap.com> on 2013/10/07 08:32:30 UTC

MD5 digest calculation

Hi,

Is there a component to do MD5 digest calculation in camel?

Regards,
Arpit.

Re: MD5 digest calculation

Posted by Charles Moulliard <ch...@gmail.com>.
Hi Goyal,

Q1, java code is required (link of claus) or
http://docs.oracle.com/javase/6/docs/api/java/security/MessageDigest.html#getInstance%28java.lang.String%29

Q2 : this is the way to go

Regards,

Charles



On Tue, Oct 8, 2013 at 10:18 AM, Goyal, Arpit <ar...@sap.com> wrote:

> Hi Charles,
>
> Q1.
> Do you think this is possible with the Crypto Digital Signature?
>
>       Signature notary = Signature.getInstance("SHA1withRSA");
>       notary.initSign(pkey);
>       notary.update(strFieldsToHash.getBytes());
>       byte[] signed = notary.sign();
>
>       MessageDigest md = MessageDigest.getInstance("MD5");
>       md.update(signed);
>       byte[] mdbytes = md.digest(signed);
>
> Q2.
> Crypto component puts the signed content into the header
> 'CamelDigitalSignature'. Is there a way to inform put the signed content
> into the body? Right now I have to do the following for getting header into
> body:
>
> <camel:setBody>
>         <camle:simple> ${header.CamelDigitalSignature} </camel:simple>
> <camel:setBody>
>
>
> Regards,
> Arpit.
>
> -----Original Message-----
> From: Charles Moulliard [mailto:ch007m@gmail.com]
> Sent: Monday, October 07, 2013 12:09 PM
> To: users@camel.apache.org
> Subject: Re: MD5 digest calculation
>
> You can use the camel crypto component/dataformat for that purpose :
> http://camel.apache.org/crypto-digital-signatures.html
>
>
> On Mon, Oct 7, 2013 at 8:32 AM, Goyal, Arpit <ar...@sap.com> wrote:
>
> > Hi,
> >
> > Is there a component to do MD5 digest calculation in camel?
> >
> > Regards,
> > Arpit.
> >
>
>
>
> --
> Charles Moulliard
> Apache Committer / Architect @RedHat
> Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

RE: MD5 digest calculation

Posted by "Goyal, Arpit" <ar...@sap.com>.
Hi Charles,

Q1. 
Do you think this is possible with the Crypto Digital Signature? 

      Signature notary = Signature.getInstance("SHA1withRSA");
      notary.initSign(pkey);
      notary.update(strFieldsToHash.getBytes());
      byte[] signed = notary.sign();

      MessageDigest md = MessageDigest.getInstance("MD5");
      md.update(signed);
      byte[] mdbytes = md.digest(signed);

Q2.
Crypto component puts the signed content into the header 'CamelDigitalSignature'. Is there a way to inform put the signed content into the body? Right now I have to do the following for getting header into body:

<camel:setBody> 
	<camle:simple> ${header.CamelDigitalSignature} </camel:simple>
<camel:setBody>


Regards,
Arpit.

-----Original Message-----
From: Charles Moulliard [mailto:ch007m@gmail.com] 
Sent: Monday, October 07, 2013 12:09 PM
To: users@camel.apache.org
Subject: Re: MD5 digest calculation

You can use the camel crypto component/dataformat for that purpose :
http://camel.apache.org/crypto-digital-signatures.html


On Mon, Oct 7, 2013 at 8:32 AM, Goyal, Arpit <ar...@sap.com> wrote:

> Hi,
>
> Is there a component to do MD5 digest calculation in camel?
>
> Regards,
> Arpit.
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

Re: MD5 digest calculation

Posted by Charles Moulliard <ch...@gmail.com>.
You can use the camel crypto component/dataformat for that purpose :
http://camel.apache.org/crypto-digital-signatures.html


On Mon, Oct 7, 2013 at 8:32 AM, Goyal, Arpit <ar...@sap.com> wrote:

> Hi,
>
> Is there a component to do MD5 digest calculation in camel?
>
> Regards,
> Arpit.
>



-- 
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog :  http://cmoulliard.github.io

RE: MD5 digest calculation

Posted by "Goyal, Arpit" <ar...@sap.com>.
Hi Claus,

I have anyways sent a follow-up today! I know we can do it with Java code...and currently that is the same we are doing. Want to know if any existing camel component can perform the same steps (see below java code)!

Q1. 
Do you think this is possible with the Crypto Digital Signature? 

      Signature notary = Signature.getInstance("SHA1withRSA");
      notary.initSign(pkey);
      notary.update(strFieldsToHash.getBytes());
      byte[] signed = notary.sign();

      MessageDigest md = MessageDigest.getInstance("MD5");
      md.update(signed);
      byte[] mdbytes = md.digest(signed);

Q2.
Crypto component puts the signed content into the header 'CamelDigitalSignature'. Is there a way to inform put the signed content into the body? Right now I have to do the following for getting header into body:

<camel:setBody> 
	<camle:simple> ${header.CamelDigitalSignature} </camel:simple>
<camel:setBody>

-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Sent: Tuesday, October 08, 2013 2:27 PM
To: users@camel.apache.org
Subject: Re: MD5 digest calculation

Hi

See
http://stackoverflow.com/questions/304268/getting-a-files-md5-checksum-in-java

And then you can just have a java bean doing the MD5 and use the bean in Camel.

On Mon, Oct 7, 2013 at 8:32 AM, Goyal, Arpit <ar...@sap.com> wrote:
> Hi,
>
> Is there a component to do MD5 digest calculation in camel?
>
> Regards,
> Arpit.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: MD5 digest calculation

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See
http://stackoverflow.com/questions/304268/getting-a-files-md5-checksum-in-java

And then you can just have a java bean doing the MD5 and use the bean in Camel.

On Mon, Oct 7, 2013 at 8:32 AM, Goyal, Arpit <ar...@sap.com> wrote:
> Hi,
>
> Is there a component to do MD5 digest calculation in camel?
>
> Regards,
> Arpit.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen