Re: Storing byte[] array
Re: Storing byte[] array
- Subject: Re: Storing byte[] array
- From: Mark Morris <email@hidden>
- Date: Sat, 26 Mar 2005 16:50:36 -0600
When I've run into this problem, I've taken the brute-force, it may not
be the most efficient but it'll work, approach of converting the byte[]
into a hex string, and storing this. It doubles the storage required
(2 chars per byte), so it depends on the data requirements if it's the
right answer for you. But you're pretty much guaranteed to get back
from the db what you stored. The nice thing is you can implement it in
your accessor methods and never worry about it again. :-)
Regards,
Mark
On Mar 26, 2005, at 4:27 PM, Drew Thoeni wrote:
I've successfully implemented the javax.crypto.spec.PBEKeySpec
(password-based encryption) for encrypting key information in my
database. I can encrypt and decrypt with ease now. But wait! I can't
seem to figure out how to store this marvelously encrypted info.
The PBEKeySpec pbeCipher.doFinal() generates a byte[] array, each byte
being a hex value. In any attempt I have made in storing this to the
database, WO converts it to a string and gets very unpredictable
results due to the conversion to non-printable characters.
How is this normally done so it can be store and, importantly,
retrieved in a form that can be converted back?
Regards,
Drew
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden