Jasypt Users Forum

Windows/Unix Encoding Issue?

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

Windows/Unix Encoding Issue?

by kcav8or :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have a database column that is using the Jasypt/Hibernate encryptedString Type annotation.  The data is stored in MySql.  This works fine on my development database, which is local on my Windows machine.  However, when I try to obtain the same data from my test database running on a Unix box, I get an EncryptionOperationNotPossibleException.

Tomcat is still running on the windows machine, so is this a Unix/Windows encoding difference?  I see some mention in the FAQ of performing UTF-8, then BASE64 encoding.  If so, can you provide a code example?

I saw another post about this error where the poster had his database column too short.  But I don't think this is the problem in my case because my column is defined as VARCHAR(128).  The unencrypted data is about 50 characters in length.  The encrypted data in both databases appears to be identical when a SQL query is performed.

Re: Windows/Unix Encoding Issue?

by kcav8or :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Here's an update.  It also happens when I run both the app and database on the Unix box.

I know that the JCE is installed properly because the app decrypts configuration properties correctly, and it also decodes the password upon login.  So the problem seems to be isolated to the org.jasypt.hibernate.type.EncryptedStringType.

kcav8or wrote:
I have a database column that is using the Jasypt/Hibernate encryptedString Type annotation.  The data is stored in MySql.  This works fine on my development database, which is local on my Windows machine.  However, when I try to obtain the same data from my test database running on a Unix box, I get an EncryptionOperationNotPossibleException.

Tomcat is still running on the windows machine, so is this a Unix/Windows encoding difference?  I see some mention in the FAQ of performing UTF-8, then BASE64 encoding.  If so, can you provide a code example?

I saw another post about this error where the poster had his database column too short.  But I don't think this is the problem in my case because my column is defined as VARCHAR(128).  The unencrypted data is about 50 characters in length.  The encrypted data in both databases appears to be identical when a SQL query is performed.

Re: Windows/Unix Encoding Issue?

by dfernandez :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

Hi,

 From your description, I would discard any problems in jasypt itself,
and also in character encoding compatibilities at the Java side (jasypt
takes care of this). I would suspect of the default Linux setup in
MySQL, or the properties of the database itself, the size of the
columns... let's do some checks:

  - Is the data you had in the Windows database exactly the same as the
data you have now in the Linux database? Is it possible that the length
of your database column is not enough for the encrypted results of some
of your tuples (at least one of them)?
  - Does this happen to you whichever the encrypted text is (specially
in length)?
  - Is the database created with the same configuration in Windows and
Linux? Engine (InnoDB/ISAM), null treatment, etc...?
  - Have you tried with both null and not-null data? (Maybe your MySQL
converts nulls to empty strings and this provokes errors...)

Regards,
Daniel.


kcav8or wrote:

> +------------------------+
>   Jasypt Users List      
>   http://www.jasypt.org 
> +------------------------+
>
> Here's an update.  It also happens when I run both the app and database on
> the Unix box.
>
> I know that the JCE is installed properly because the app decrypts
> configuration properties correctly, and it also decodes the password upon
> login.  So the problem seems to be isolated to the
> org.jasypt.hibernate.type.EncryptedStringType.
>
>
> kcav8or wrote:
>  
>> I have a database column that is using the Jasypt/Hibernate
>> encryptedString Type annotation.  The data is stored in MySql.  This works
>> fine on my development database, which is local on my Windows machine.
>> However, when I try to obtain the same data from my test database running
>> on a Unix box, I get an EncryptionOperationNotPossibleException.
>>
>> Tomcat is still running on the windows machine, so is this a Unix/Windows
>> encoding difference?  I see some mention in the FAQ of performing UTF-8,
>> then BASE64 encoding.  If so, can you provide a code example?
>>
>> I saw another post about this error where the poster had his database
>> column too short.  But I don't think this is the problem in my case
>> because my column is defined as VARCHAR(128).  The unencrypted data is
>> about 50 characters in length.  The encrypted data in both databases
>> appears to be identical when a SQL query is performed.
>>
>>    
>
>  


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jasypt-users mailing list
jasypt-users@...
https://lists.sourceforge.net/lists/listinfo/jasypt-users

Re: Windows/Unix Encoding Issue?

by kcav8or :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Aha!  I found one row that contained unencrypted data from a previous test run.  When I nulled that out it worked.

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

Hi,

 From your description, I would discard any problems in jasypt itself,
and also in character encoding compatibilities at the Java side (jasypt
takes care of this). I would suspect of the default Linux setup in
MySQL, or the properties of the database itself, the size of the
columns... let's do some checks:

  - Is the data you had in the Windows database exactly the same as the
data you have now in the Linux database? Is it possible that the length
of your database column is not enough for the encrypted results of some
of your tuples (at least one of them)?
  - Does this happen to you whichever the encrypted text is (specially
in length)?
  - Is the database created with the same configuration in Windows and
Linux? Engine (InnoDB/ISAM), null treatment, etc...?
  - Have you tried with both null and not-null data? (Maybe your MySQL
converts nulls to empty strings and this provokes errors...)

Regards,
Daniel.


kcav8or wrote:
> +------------------------+
>   Jasypt Users List      
>   http://www.jasypt.org 
> +------------------------+
>
> Here's an update.  It also happens when I run both the app and database on
> the Unix box.
>
> I know that the JCE is installed properly because the app decrypts
> configuration properties correctly, and it also decodes the password upon
> login.  So the problem seems to be isolated to the
> org.jasypt.hibernate.type.EncryptedStringType.
>
>
> kcav8or wrote:
>  
>> I have a database column that is using the Jasypt/Hibernate
>> encryptedString Type annotation.  The data is stored in MySql.  This works
>> fine on my development database, which is local on my Windows machine.
>> However, when I try to obtain the same data from my test database running
>> on a Unix box, I get an EncryptionOperationNotPossibleException.
>>
>> Tomcat is still running on the windows machine, so is this a Unix/Windows
>> encoding difference?  I see some mention in the FAQ of performing UTF-8,
>> then BASE64 encoding.  If so, can you provide a code example?
>>
>> I saw another post about this error where the poster had his database
>> column too short.  But I don't think this is the problem in my case
>> because my column is defined as VARCHAR(128).  The unencrypted data is
>> about 50 characters in length.  The encrypted data in both databases
>> appears to be identical when a SQL query is performed.
>>
>>    
>
>  


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
jasypt-users mailing list
jasypt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jasypt-users
LightInTheBox - Buy quality products at wholesale price!