equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
21 * questions. |
21 * questions. |
22 */ |
22 */ |
23 |
23 |
24 /* |
24 /* |
25 * @test |
25 * @test |
26 * @bug 0000000 |
26 * @bug 7087021 |
27 * @summary MacClone |
27 * @summary MacClone |
28 * @author Jan Luehe |
28 * @author Jan Luehe |
29 */ |
29 */ |
30 import javax.crypto.*; |
30 import javax.crypto.*; |
31 |
31 |
54 // Clone initialized Mac object |
54 // Clone initialized Mac object |
55 // |
55 // |
56 KeyGenerator kgen = KeyGenerator.getInstance("DES"); |
56 KeyGenerator kgen = KeyGenerator.getInstance("DES"); |
57 SecretKey skey = kgen.generateKey(); |
57 SecretKey skey = kgen.generateKey(); |
58 |
58 |
59 mac = Mac.getInstance("HmacSHA1"); |
59 mac = Mac.getInstance("HmacSHA1", "SunJCE"); |
60 mac.init(skey); |
60 mac.init(skey); |
61 macClone = (Mac)mac.clone(); |
61 macClone = (Mac)mac.clone(); |
62 System.out.println(macClone.getProvider().toString()); |
62 System.out.println(macClone.getProvider().toString()); |
63 System.out.println(macClone.getAlgorithm()); |
63 System.out.println(macClone.getAlgorithm()); |
64 mac.update((byte)0x12); |
64 mac.update((byte)0x12); |