   | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | |  | fail to output Document to encrypted file | fail to output Document to encrypted file 2003-12-05 - By ??????
Back Using "flowfish", I encrypted an xml file which is from a Document instance and successfully rebuilt the Document instance from the encypted file. Then before closing my application, I output the Document instance to an encrypted file. The code is as below, but the resulting file is not all right and seems to lack a few bytes(especially the last bytes) after it is decrypted.
try { String indent = " "; boolean newLines = true; XMLOutputter outp = new XMLOutputter(indent, newLines, "GB2312"); outp.setTextTrim(true); // doc is a correct Document instance // catFilePath is a String instance // cipher is a Cipher instance for encrypting outp.output(doc,new CipherOutputStream( new FileOutputStream(catFilePath),cipher)); } catch (Exception e) {e.printStackTrace();}
If I change indent,newLines,or remove "outp.setTextTrim(true)", the resulting file changes a little accordingly.
__ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected) .com
Earn $52 per hosting referral at Lunarpages.
|
|
 |