I need to write object to XML so I use XMLEncoder but one of the variables (String) in this object should be crypted. Is it possible to capture object while writing and then replace the value (but don't set the value in object)?
Asked
Active
Viewed 167 times
1 Answers
0
Yes. XMLEncoder uses serialization so you can use normal serialization rules to override the default behaviour of the serialization in readObject and writeObject.
http://java.sun.com/products/jfc/tsc/articles/persistence4/
Although some could argue if it is important enough to encrypt an object on a file, maybe you should keep it encrypted in memory as that is just as easy to look at.

Woody
- 5,052
- 2
- 22
- 28