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 * @modules java.base/sun.security.util
29 * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
30 * @run main SSLSocketKeyLimit 0 server AES/GCM/NoPadding keyupdate 1000000
31 * @run main SSLSocketKeyLimit 0 client AES/GCM/NoPadding keyupdate 1000000
32 * @run main SSLSocketKeyLimit 1 client AES/GCM/NoPadding keyupdate 2^22
33 */
34
35 /**
36 * Verify AES/GCM's limits set in the jdk.tls.keyLimits property
37 * start a new handshake sequence to renegotiate the symmetric key with an
38 * SSLSocket connection. This test verifies the handshake method was called
39 * via debugging info. It does not verify the renegotiation was successful
40 * as that is very hard.
41 */
42
43 import javax.net.ssl.KeyManagerFactory;
44 import javax.net.ssl.SSLContext;
45 import javax.net.ssl.SSLServerSocket;
46 import javax.net.ssl.SSLServerSocketFactory;
47 import javax.net.ssl.SSLSocket;
48 import javax.net.ssl.SSLSocketFactory;
49 import javax.net.ssl.TrustManagerFactory;
50 import java.io.ByteArrayInputStream;
51 import java.io.ByteArrayOutputStream;
52 import java.io.File;
53 import java.io.InputStream;
54 import java.io.OutputStream;
55 import java.io.PrintWriter;
56 import java.security.KeyStore;
57 import java.security.SecureRandom;
58 import java.util.Arrays;
59
60 import jdk.testlibrary.ProcessTools;
61 import jdk.testlibrary.Utils;
62 import jdk.testlibrary.OutputAnalyzer;
63 import sun.security.util.HexDumpEncoder;
64
65 public class SSLSocketKeyLimit {
66 SSLSocket socket;
67 private InputStream in;
68 private OutputStream out;
69
70 static boolean serverReady = false;
71 static int serverPort = 0;
72
73 static String pathToStores = "../../../../javax/net/ssl/etc/";
74 static String keyStoreFile = "keystore";
75 static String passwd = "passphrase";
76 static int dataLen = 10240;
77 static byte[] data = new byte[dataLen];
78 static boolean serverwrite = true;
79 int totalDataLen = 0;
80 static boolean done = false;
81
82 SSLSocketKeyLimit() {
|
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 * @modules java.base/sun.security.util
30 * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
31 * @run main SSLSocketKeyLimit 0 server AES/GCM/NoPadding keyupdate 1000000
32 * @run main SSLSocketKeyLimit 0 client AES/GCM/NoPadding keyupdate 1000000
33 * @run main SSLSocketKeyLimit 1 client AES/GCM/NoPadding keyupdate 2^22
34 */
35
36 /**
37 * Verify AES/GCM's limits set in the jdk.tls.keyLimits property
38 * start a new handshake sequence to renegotiate the symmetric key with an
39 * SSLSocket connection. This test verifies the handshake method was called
40 * via debugging info. It does not verify the renegotiation was successful
41 * as that is very hard.
42 */
43
44 import javax.net.ssl.KeyManagerFactory;
45 import javax.net.ssl.SSLContext;
46 import javax.net.ssl.SSLServerSocket;
47 import javax.net.ssl.SSLServerSocketFactory;
48 import javax.net.ssl.SSLSocket;
49 import javax.net.ssl.SSLSocketFactory;
50 import javax.net.ssl.TrustManagerFactory;
51 import java.io.File;
52 import java.io.InputStream;
53 import java.io.OutputStream;
54 import java.io.PrintWriter;
55 import java.security.KeyStore;
56 import java.security.SecureRandom;
57 import java.util.Arrays;
58
59 import jdk.test.lib.process.OutputAnalyzer;
60 import jdk.test.lib.process.ProcessTools;
61 import jdk.testlibrary.Utils;
62 import sun.security.util.HexDumpEncoder;
63
64 public class SSLSocketKeyLimit {
65 SSLSocket socket;
66 private InputStream in;
67 private OutputStream out;
68
69 static boolean serverReady = false;
70 static int serverPort = 0;
71
72 static String pathToStores = "../../../../javax/net/ssl/etc/";
73 static String keyStoreFile = "keystore";
74 static String passwd = "passphrase";
75 static int dataLen = 10240;
76 static byte[] data = new byte[dataLen];
77 static boolean serverwrite = true;
78 int totalDataLen = 0;
79 static boolean done = false;
80
81 SSLSocketKeyLimit() {
|