Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 33DFCEBC9 for ; Fri, 30 Nov 2012 13:18:16 +0000 (UTC) Received: (qmail 5533 invoked by uid 500); 30 Nov 2012 13:18:16 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 5465 invoked by uid 500); 30 Nov 2012 13:18:14 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 5455 invoked by uid 99); 30 Nov 2012 13:18:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 13:18:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Nov 2012 13:18:08 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3A25F23888E4; Fri, 30 Nov 2012 13:17:47 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1415618 - /cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Date: Fri, 30 Nov 2012 13:17:47 -0000 To: commits@cxf.apache.org From: ay@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121130131747.3A25F23888E4@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ay Date: Fri Nov 30 13:17:46 2012 New Revision: 1415618 URL: http://svn.apache.org/viewvc?rev=1415618&view=rev Log: some addition and minor improvent to CXF-4596 Modified: cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Modified: cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java URL: http://svn.apache.org/viewvc/cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java?rev=1415618&r1=1415617&r2=1415618&view=diff ============================================================================== --- cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java (original) +++ cxf/trunk/api/src/main/java/org/apache/cxf/io/CachedOutputStream.java Fri Nov 30 13:17:46 2012 @@ -35,6 +35,7 @@ import java.io.PipedOutputStream; import java.io.Reader; import java.security.GeneralSecurityException; import java.security.Key; +import java.security.SecureRandom; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -93,7 +94,6 @@ public class CachedOutputStream extends private String cipherTransformation = defaultCipherTransformation; private Cipher enccipher; private Cipher deccipher; - private List callbacks; @@ -500,7 +500,6 @@ public class CachedOutputStream extends currentStream = createOutputStream(tempFile); bout.writeTo(currentStream); - currentStream = new BufferedOutputStream(currentStream); inmem = false; streamList.add(currentStream); } catch (Exception ex) { @@ -640,7 +639,9 @@ public class CachedOutputStream extends a = cipherTransformation; } try { - Key key = KeyGenerator.getInstance(a).generateKey(); + KeyGenerator keygen = KeyGenerator.getInstance(a); + keygen.init(new SecureRandom()); + Key key = keygen.generateKey(); enccipher = Cipher.getInstance(cipherTransformation); deccipher = Cipher.getInstance(cipherTransformation); enccipher.init(Cipher.ENCRYPT_MODE, key); @@ -655,7 +656,7 @@ public class CachedOutputStream extends } private OutputStream createOutputStream(File file) throws IOException { - OutputStream out = new FileOutputStream(file); + OutputStream out = new BufferedOutputStream(new FileOutputStream(file)); if (cipherTransformation != null) { try { initCiphers();