Google Search
Google


Google
Google
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
Subjects
JSP editor plugin for eclipse ?
org apache jasper JasperException: Unable to compile class for JSP
Tomcat: Connection reset by peer: socket write error
Cannot retrieve definition for form bean null
Struts Tiles Tutorial (free Struts training)
Where do I download Tomcat 4 0 6?
Data Access Object (DAO) pattern, example DAO 's
Where to download Tomcat v 4 1 24 from?
Tomcat 5 0 16 Requested resource not available
Oracle Connection Pooling in 3 2 2
Servlet : Session invalidate
Servlet action is currently unavailable
Tomcat/Struts Unicode Encoding/Decoding problems
Tomcat and webapplication specific java library path
Running a Simple JMS Example
Mapping in workers2 properties
org apache jasper JasperException
Cannot find message resources under key org apache struts action
   MESSAGE
problem with html:text bean throwing exception
Cannot find message resources under key org apache struts action MESSAGE
invalid direct reference problem with solution
Tool for jsp debug Try Sysdeo Eclipse Plugin
Tomcat 5 Cannot load JDBC driver class 'null ' SQL state: null
weblogic ejbc
java properties file
Jboss 3 2 3 Coyote Can 't re
Tomcat 5, Apache2 and mod jk2 integration problem
JBoss example problem new to J2EE
url string for connecting jboss to oracle
Value attribute of <html:checkbox
javax servlet ServletException: BeanUtils populate
HTTP Status 404 The requested resource is not available
5 0 18: Windows XP Pro vs Windows 2000
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
fail to output Document to encrypted file

fail to output Document to encrypted file

2003-12-05       - By Laurent Bihanic

 Back
Reply:     1     2     3  


XMLOutputter does not close the stream. You should try :

      OutputStream os = new CipherOutputStream(
                      new FileOutputStream(catFilePath),cipher);
      outp.output(doc, os);
      os.close();

Laurent


On 05/12/2003 15:29, ?????? wrote:

> 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
>

--
                 wWw
                (o o)
-- ---- -----ooO-(_)-Ooo-- ---- ---- ---- ---- ---- ---- ---- ---- ----
Laurent Bihanic                | Tel: +33 (0)1 55.91.21.93 (direct)
AtosOrigin Systems Integration |      +33 (0)1 55.91.20.00
Generic Solutions / SC         | Fax: +33 (0)1 55.91.22.31
Les Miroirs - Bat. C           |
18, avenue d'Alsace            |
F-92926 La Defense Cedex       | E-mail: laurent.bihanic@(protected)
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---

"Most Linux are trying to model themselves after the dysfunctional
 MS desktop. What joy is there in running a cheap knockoff of a
 second rate desktop?"

DISCLAIMER:
The opinions expressed are entirely my own and may not necessarily be
those of my employer.  Also, I am not now nor have I ever been a
lawyer.  My opinions are provided as-is with absolutely no warrantee of
merchantability or fitness for any particular use.  Besides, you can't
prove I typed this.  No body saw me type this.  Who says I typed this?

__ ____ ____ ____ ____ ____ ____ ____ ____ ____
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected)
.com



Earn $52 per hosting referral at Lunarpages.