• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Storing byte[] array
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Storing byte[] array


  • Subject: Re: Storing byte[] array
  • From: Mark Morris <email@hidden>
  • Date: Sat, 26 Mar 2005 16:54:57 -0600

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
  • Follow-Ups:
    • Re: Storing byte[] array
      • From: Drew Thoeni <email@hidden>
References: 
 >Storing byte[] array (From: Drew Thoeni <email@hidden>)
 >Re: Storing byte[] array (From: Mark Morris <email@hidden>)

  • Prev by Date: Re: Storing byte[] array
  • Next by Date: Re: Storing byte[] array
  • Previous by thread: Re: Storing byte[] array
  • Next by thread: Re: Storing byte[] array
  • Index(es):
    • Date
    • Thread