7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
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 8164879
27 * @library /lib/testlibrary ../../
28 * @library /test/lib
29 * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
30 * start a new handshake sequence to renegotiate the symmetric key with an
31 * SSLSocket connection. This test verifies the handshake method was called
32 * via debugging info. It does not verify the renegotiation was successful
33 * as that is very hard.
34 *
35 * @run main SSLEngineKeyLimit 0 server AES/GCM/NoPadding keyupdate 1050000
36 * @run main SSLEngineKeyLimit 1 client AES/GCM/NoPadding keyupdate 2^22
37 */
38
39 /*
40 * This test runs in another process so we can monitor the debug
41 * results. The OutputAnalyzer must see correct debug output to return a
42 * success.
43 */
44
45 import javax.net.ssl.KeyManagerFactory;
46 import javax.net.ssl.SSLContext;
47 import javax.net.ssl.SSLEngine;
48 import javax.net.ssl.SSLEngineResult;
49 import javax.net.ssl.TrustManagerFactory;
50 import java.io.File;
51 import java.io.PrintWriter;
52 import java.nio.ByteBuffer;
53 import java.security.KeyStore;
54 import java.security.SecureRandom;
55 import java.util.Arrays;
56
57 import jdk.test.lib.process.ProcessTools;
58 import jdk.test.lib.process.OutputAnalyzer;
59 import jdk.testlibrary.Utils;
60
61 public class SSLEngineKeyLimit {
62
63 SSLEngine eng;
64 static ByteBuffer cTos;
65 static ByteBuffer sToc;
66 static ByteBuffer outdata;
67 ByteBuffer buf;
68 static boolean ready = false;
69
70 static String pathToStores = "../../../../javax/net/ssl/etc/";
71 static String keyStoreFile = "keystore";
72 static String passwd = "passphrase";
73 static String keyFilename;
74 static int dataLen = 10240;
75 static boolean serverwrite = true;
76 int totalDataLen = 0;
77 static boolean sc = true;
78 int delay = 1;
79 static boolean readdone = false;
|
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
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 8164879
27 * @library ../../
28 * @library /test/lib
29 * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
30 * start a new handshake sequence to renegotiate the symmetric key with an
31 * SSLSocket connection. This test verifies the handshake method was called
32 * via debugging info. It does not verify the renegotiation was successful
33 * as that is very hard.
34 *
35 * @run main SSLEngineKeyLimit 0 server AES/GCM/NoPadding keyupdate 1050000
36 * @run main SSLEngineKeyLimit 1 client AES/GCM/NoPadding keyupdate 2^22
37 */
38
39 /*
40 * This test runs in another process so we can monitor the debug
41 * results. The OutputAnalyzer must see correct debug output to return a
42 * success.
43 */
44
45 import javax.net.ssl.KeyManagerFactory;
46 import javax.net.ssl.SSLContext;
47 import javax.net.ssl.SSLEngine;
48 import javax.net.ssl.SSLEngineResult;
49 import javax.net.ssl.TrustManagerFactory;
50 import java.io.File;
51 import java.io.PrintWriter;
52 import java.nio.ByteBuffer;
53 import java.security.KeyStore;
54 import java.security.SecureRandom;
55 import java.util.Arrays;
56
57 import jdk.test.lib.process.ProcessTools;
58 import jdk.test.lib.process.OutputAnalyzer;
59 import jdk.test.lib.Utils;
60
61 public class SSLEngineKeyLimit {
62
63 SSLEngine eng;
64 static ByteBuffer cTos;
65 static ByteBuffer sToc;
66 static ByteBuffer outdata;
67 ByteBuffer buf;
68 static boolean ready = false;
69
70 static String pathToStores = "../../../../javax/net/ssl/etc/";
71 static String keyStoreFile = "keystore";
72 static String passwd = "passphrase";
73 static String keyFilename;
74 static int dataLen = 10240;
75 static boolean serverwrite = true;
76 int totalDataLen = 0;
77 static boolean sc = true;
78 int delay = 1;
79 static boolean readdone = false;
|