< prev index next >

test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java

Print this page
rev 51638 : [mq]: 8210112


   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  * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
  29  * start a new handshake sequence to renegotiate the symmetric key with an
  30  * SSLSocket connection.  This test verifies the handshake method was called
  31  * via debugging info.  It does not verify the renegotiation was successful
  32  * as that is very hard.
  33  *
  34  * @run main SSLEngineKeyLimit 0 server AES/GCM/NoPadding keyupdate 1050000
  35  * @run main SSLEngineKeyLimit 1 client AES/GCM/NoPadding keyupdate 2^22
  36  */
  37 
  38 /*
  39  * This test runs in another process so we can monitor the debug
  40  * results.  The OutputAnalyzer must see correct debug output to return a
  41  * success.
  42  */
  43 
  44 import javax.net.ssl.KeyManagerFactory;
  45 import javax.net.ssl.SSLContext;
  46 import javax.net.ssl.SSLEngine;
  47 import javax.net.ssl.SSLEngineResult;
  48 import javax.net.ssl.TrustManagerFactory;
  49 import java.io.File;
  50 import java.io.PrintWriter;
  51 import java.nio.ByteBuffer;
  52 import java.security.KeyStore;
  53 import java.security.SecureRandom;
  54 import java.util.Arrays;
  55 
  56 import jdk.testlibrary.ProcessTools;

  57 import jdk.testlibrary.Utils;
  58 import jdk.testlibrary.OutputAnalyzer;
  59 
  60 public class SSLEngineKeyLimit {
  61 
  62     SSLEngine eng;
  63     static ByteBuffer cTos;
  64     static ByteBuffer sToc;
  65     static ByteBuffer outdata;
  66     ByteBuffer buf;
  67     static boolean ready = false;
  68 
  69     static String pathToStores = "../../../../javax/net/ssl/etc/";
  70     static String keyStoreFile = "keystore";
  71     static String passwd = "passphrase";
  72     static String keyFilename;
  73     static int dataLen = 10240;
  74     static boolean serverwrite = true;
  75     int totalDataLen = 0;
  76     static boolean sc = true;
  77     int delay = 1;
  78     static boolean readdone = false;




   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;


< prev index next >