10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 7160837
27 * @summary Make sure Cipher IO streams doesn't call extra doFinal if close()
28 * is called multiple times. Additionally, verify the input and output streams
29 * match with encryption and decryption with non-stream crypto.
30 * @compile -addmods java.xml.bind CipherStreamClose.java
31 * @run main/othervm -addmods java.xml.bind CipherStreamClose
32 */
33
34 import java.io.*;
35 import java.security.DigestOutputStream;
36 import java.security.DigestInputStream;
37 import java.security.MessageDigest;
38 import java.util.Arrays;
39
40 import javax.crypto.Cipher;
41 import javax.crypto.CipherOutputStream;
42 import javax.crypto.CipherInputStream;
43 import javax.crypto.SecretKey;
44 import javax.crypto.spec.SecretKeySpec;
45 import javax.xml.bind.DatatypeConverter;
46
47 public class CipherStreamClose {
48 private static final String message = "This is the sample message";
49 static boolean debug = false;
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 /*
25 * @test
26 * @bug 7160837
27 * @summary Make sure Cipher IO streams doesn't call extra doFinal if close()
28 * is called multiple times. Additionally, verify the input and output streams
29 * match with encryption and decryption with non-stream crypto.
30 * @modules java.xml.bind
31 * @compile -addmods java.xml.bind CipherStreamClose.java
32 * @run main/othervm -addmods java.xml.bind CipherStreamClose
33 */
34
35 import java.io.*;
36 import java.security.DigestOutputStream;
37 import java.security.DigestInputStream;
38 import java.security.MessageDigest;
39 import java.util.Arrays;
40
41 import javax.crypto.Cipher;
42 import javax.crypto.CipherOutputStream;
43 import javax.crypto.CipherInputStream;
44 import javax.crypto.SecretKey;
45 import javax.crypto.spec.SecretKeySpec;
46 import javax.xml.bind.DatatypeConverter;
47
48 public class CipherStreamClose {
49 private static final String message = "This is the sample message";
50 static boolean debug = false;
|