File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Object to byte[] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Object to byte[]" Watch "Object to byte[]" New topic
Author

Object to byte[]

Thai C. Tran
Greenhorn

Joined: Jul 05, 2009
Posts: 26
Dear all,

I use the code below to write object into file. However, in the final file, i also have the class name and the signature of the class. Due to the security problem, i want to get rid of them. How can I implement it in Java ?


David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

you can provide your own writeObject/readObject implementations for your object types rather than relying on the defaults.
I'm not sure what 'security issues' you're trying to resolve, but those methods are how you implement customized Object serialization.
Thai C. Tran
Greenhorn

Joined: Jul 05, 2009
Posts: 26
I am developing a cryptography app by using java. In the end of the process, password from user is encrypted and added with some other parameters and meta data into an object, which will be saved into file for the later usage. Therefore, leaving some footprints in the final file is not good. The file will be also read by another program (in C++), so the structure of the file is fixed as well. The content of the object is correct right now, except when being converted into byte array, Java automatically add more information into the final data
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object to byte[]
 
Similar Threads
ObjectOutputStream Make copy of Serialized File
How I get byte[ ] from Object?
Please help me debug this - Converting Object to byte[] and vice versa.
Storing serialized objects
How many objects are serialized ?