You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ga...@barclays.com on 2013/03/27 22:47:35 UTC

JASYPT String Decryption

Hi,
Please advise if anyone know how to decrypt the jasyped value inside a class ?

We are planning to encrypt the password values using jasypt and store in a Databases.

We want to decrypt the value back inside a bean class. Please advise if it's possible

Thanks
Ganesh

_______________________________________________

This message may contain information that is confidential or privileged. If you are not an intended recipient of this message, please delete it and any attachments, and notify the sender that you have received it in error. Unless specifically stated in the message or otherwise indicated, you may not duplicate, redistribute or forward this message or any portion thereof, including any attachments, by any means to any other person, including any retail investor or customer. This message is not a recommendation, advice, offer or solicitation, to buy/sell any product or service, and is not an official confirmation of any transaction. Any opinions presented are solely those of the author and do not necessarily represent those of Barclays.

This message is subject to terms available at: www.barclays.com/emaildisclaimer and, if received from Barclays' Sales or Trading desk, the terms available at: www.barclays.com/salesandtradingdisclaimer/. By messaging with Barclays you consent to the foregoing. Barclays Bank PLC is a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays group.

_______________________________________________

RE: JASYPT String Decryption

Posted by ga...@barclays.com.
Thanks Ibsen, I followed the below steps and it works like Charm‼!

The original password we have will be encrypted with the master password.

F:\Camel\apache-camel-2.10.3\lib>java -jar camel-jasypt-2.10.3.jar -c encrypt -p secret -i Ganesh
Encrypted text: wJdhCP0vS8ynUrUSDVwF1Q==

The Encrypted text value can be stored in the 100 byte of string in the database( mainly for FTP process). The following changes are done to integrate the Jasypt into the application.

1.      Bean Definition

                  <bean id="jasypt" class="org.apache.camel.component.jasypt.JasyptPropertiesParser">
                        <property name="password" value="secret"/>
      </bean>

2.      Inject bean into any class.

<bean id="fileCopyFilter" class="com.barclays.ccs.filecopy.utils.filters.FileCopyFileFilter">
                        <constructor-arg  ref="sessionFactory"/>
            <constructor-arg  ref="jasypt"/>
</bean>

3.      Get hold of the parser and decrypt the value back.

                  String password = jasyptparser.parseProperty(null, "ENC(ys8/O1bndJr4C046uHignHm4gTTCSmnl)", null);
System.out.println(password);


-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
Sent: Thursday, March 28, 2013 2:14 AM
To: users@camel.apache.org
Subject: Re: JASYPT String Decryption

On Wed, Mar 27, 2013 at 10:47 PM,  <ga...@barclays.com>> wrote:
> Hi,
> Please advise if anyone know how to decrypt the jasyped value inside a class ?
>
> We are planning to encrypt the password values using jasypt and store in a Databases.
>
> We want to decrypt the value back inside a bean class. Please advise
> if it's possible
>

Hi

You can use this method from CamelContext
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html#resolvePropertyPlaceholders(java.lang.String)

and just put in the value in the method as you would do in the endpoint uris, eg with ENC(value) around the value.
http://camel.apache.org/jasypt

An alternative is to get hold of the JasyptPropertiesParser and use its API http://camel.apache.org/jasypt


Or use the Jasypt library without Camel.




> Thanks
> Ganesh
>
> _______________________________________________
>
> This message may contain information that is confidential or privileged. If you are not an intended recipient of this message, please delete it and any attachments, and notify the sender that you have received it in error. Unless specifically stated in the message or otherwise indicated, you may not duplicate, redistribute or forward this message or any portion thereof, including any attachments, by any means to any other person, including any retail investor or customer. This message is not a recommendation, advice, offer or solicitation, to buy/sell any product or service, and is not an official confirmation of any transaction. Any opinions presented are solely those of the author and do not necessarily represent those of Barclays.
>
> This message is subject to terms available at: www.barclays.com/emaildisclaimer<http://www.barclays.com/emaildisclaimer> and, if received from Barclays' Sales or Trading desk, the terms available at: www.barclays.com/salesandtradingdisclaimer/<http://www.barclays.com/salesandtradingdisclaimer/>. By messaging with Barclays you consent to the foregoing. Barclays Bank PLC is a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays group.
>
> _______________________________________________



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com<ma...@redhat.com>
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen


_______________________________________________

This message may contain information that is confidential or privileged. If you are not an intended recipient of this message, please delete it and any attachments, and notify the sender that you have received it in error. Unless specifically stated in the message or otherwise indicated, you may not duplicate, redistribute or forward this message or any portion thereof, including any attachments, by any means to any other person, including any retail investor or customer. This message is not a recommendation, advice, offer or solicitation, to buy/sell any product or service, and is not an official confirmation of any transaction. Any opinions presented are solely those of the author and do not necessarily represent those of Barclays.

This message is subject to terms available at: www.barclays.com/emaildisclaimer and, if received from Barclays' Sales or Trading desk, the terms available at: www.barclays.com/salesandtradingdisclaimer/. By messaging with Barclays you consent to the foregoing. Barclays Bank PLC is a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays group.

_______________________________________________

Re: JASYPT String Decryption

Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Mar 27, 2013 at 10:47 PM,  <ga...@barclays.com> wrote:
> Hi,
> Please advise if anyone know how to decrypt the jasyped value inside a class ?
>
> We are planning to encrypt the password values using jasypt and store in a Databases.
>
> We want to decrypt the value back inside a bean class. Please advise if it's possible
>

Hi

You can use this method from CamelContext
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/CamelContext.html#resolvePropertyPlaceholders(java.lang.String)

and just put in the value in the method as you would do in the
endpoint uris, eg with ENC(value) around the value.
http://camel.apache.org/jasypt

An alternative is to get hold of the JasyptPropertiesParser and use its API
http://camel.apache.org/jasypt


Or use the Jasypt library without Camel.




> Thanks
> Ganesh
>
> _______________________________________________
>
> This message may contain information that is confidential or privileged. If you are not an intended recipient of this message, please delete it and any attachments, and notify the sender that you have received it in error. Unless specifically stated in the message or otherwise indicated, you may not duplicate, redistribute or forward this message or any portion thereof, including any attachments, by any means to any other person, including any retail investor or customer. This message is not a recommendation, advice, offer or solicitation, to buy/sell any product or service, and is not an official confirmation of any transaction. Any opinions presented are solely those of the author and do not necessarily represent those of Barclays.
>
> This message is subject to terms available at: www.barclays.com/emaildisclaimer and, if received from Barclays' Sales or Trading desk, the terms available at: www.barclays.com/salesandtradingdisclaimer/. By messaging with Barclays you consent to the foregoing. Barclays Bank PLC is a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP. This email may relate to or be sent from other members of the Barclays group.
>
> _______________________________________________



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

Re: JASYPT String Decryption

Posted by Christian Müller <ch...@gmail.com>.
http://www.jasypt.org

Sent from a mobile device
Am 27.03.2013 22:48 schrieb <ga...@barclays.com>:

> Hi,
> Please advise if anyone know how to decrypt the jasyped value inside a
> class ?
>
> We are planning to encrypt the password values using jasypt and store in a
> Databases.
>
> We want to decrypt the value back inside a bean class. Please advise if
> it's possible
>
> Thanks
> Ganesh
>
> _______________________________________________
>
> This message may contain information that is confidential or privileged.
> If you are not an intended recipient of this message, please delete it and
> any attachments, and notify the sender that you have received it in error.
> Unless specifically stated in the message or otherwise indicated, you may
> not duplicate, redistribute or forward this message or any portion thereof,
> including any attachments, by any means to any other person, including any
> retail investor or customer. This message is not a recommendation, advice,
> offer or solicitation, to buy/sell any product or service, and is not an
> official confirmation of any transaction. Any opinions presented are solely
> those of the author and do not necessarily represent those of Barclays.
>
> This message is subject to terms available at:
> www.barclays.com/emaildisclaimer and, if received from Barclays' Sales or
> Trading desk, the terms available at:
> www.barclays.com/salesandtradingdisclaimer/. By messaging with Barclays
> you consent to the foregoing. Barclays Bank PLC is a company registered in
> England (number 1026167) with its registered office at 1 Churchill Place,
> London, E14 5HP. This email may relate to or be sent from other members of
> the Barclays group.
>
> _______________________________________________
>