Jasypt Users Forum

Encrypting url parameters

View: New views
2 Messages — Rating Filter:   Alert me  

Encrypting url parameters

by mxpx26 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all,

I am wondering what the best method to encrypt url paramters is (example encrypting number identifiers when url rewriting).

Right now I am using this configuration in spring

<bean id="urlEncryptor" class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
    <property name="password">
        <value>greggreg</value>
    </property>
    <property name="algorithm">
        <value>PBEWithMD5AndTripleDES</value>
    </property>
  </bean>

When I encrypt I often get http reserved signs (such as +, /, etc..), therefore I thought of using the URLCodec class in order to encode the encrypted data. This works most of the time except sometimes I get a org.jasypt.exceptions.EncryptionOperationNotPossibleException (I unenocde the data with URLCodec  then try decrypt (often caused by a '+' sign in the encryptd data). I thought using the URLCodec class would fix all my problems but still get random EncryptionOperationNotPossibleException. Anyone have any experience with this? Should I use another encryptor, algorithm? Thanks

Re: Encrypting url parameters

by dfernandez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

+------------------------+
  Jasypt Users List      
  http://www.jasypt.org 
+------------------------+

Hello,

Using StandardPBEStringEncryptor, you can set the output to hexadecimal
instead of BASE64 (which is the default). Hexa will be completely
URL-safe for you...

Regards,
Daniel.


mxpx26 wrote:

> +------------------------+
>   Jasypt Users List      
>   http://www.jasypt.org 
> +------------------------+
>
> Hello all,
>
> I am wondering what the best method to encrypt url paramters is (example
> encrypting number identifiers when url rewriting).
>
> Right now I am using this configuration in spring
>
> <bean id="urlEncryptor"
> class="org.jasypt.encryption.pbe.StandardPBEStringEncryptor">
>     <property name="password">
>         <value>greggreg</value>
>     </property>
>     <property name="algorithm">
>         <value>PBEWithMD5AndTripleDES</value>
>     </property>
>   </bean>
>
> When I encrypt I often get http reserved signs (such as +, /, etc..),
> therefore I thought of using the URLCodec class in order to encode the
> encrypted data. This works most of the time except sometimes I get a
> org.jasypt.exceptions.EncryptionOperationNotPossibleException (I unenocde
> the data with URLCodec  then try decrypt (often caused by a '+' sign in the
> encryptd data). I thought using the URLCodec class would fix all my problems
> but still get random EncryptionOperationNotPossibleException. Anyone have
> any experience with this? Should I use another encryptor, algorithm? Thanks
>  


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
jasypt-users mailing list
jasypt-users@...
https://lists.sourceforge.net/lists/listinfo/jasypt-users