Re: Storing byte[] array
Re: Storing byte[] array
- Subject: Re: Storing byte[] array
- From: Drew Thoeni <email@hidden>
- Date: Sat, 26 Mar 2005 18:01:39 -0500
The result is an array with 24 bytes, each being a hex. I think I am
also missing something. byte is a primative and, I thought (I'm pretty
new at this) it would not have any methods. How do you go about
converting it to to two chars hex?
BLOB, though, might be simpler.
Drew
On Mar 26, 2005, at 5:54 PM, Mark Morris wrote:
Of course, for larger chunks of data, a BLOB or similar might be a
better choice. ;-)
-- Mark
On Mar 26, 2005, at 4:50 PM, Mark Morris wrote:
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:
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