views:

54

answers:

1

Hi,

One of the reason I use StAX is because of it low memory consumption in processing large xml files.

I've been requested to encrypt the whole xml files, and decrypt them later.

The easier solution I can come up with, without having major change to existing code, is encrypt content only.

  xsw.writeStartElement("row");
  xsw.writeCharacters(Encrypter.encrypt("z"));
  xsw.writeEndElement();

However people still can understand the structure of the data. What if I want to encrypt everything in xml? Any Solution? Bear in mind that I am dealing with large xml file :)

Thanks.

+2  A: 

Use CipherInputStream/CipherOutputStream and pipe your StAX stream through it, IMO it'd be more efficient and secure than encrypting values only.

OneOfOne