test/jdk/javax/net/ssl/ServerName/SSLSocketSNISensitive.java
branchJDK-8145252-TLS13-branch
changeset 56542 56aaa6cb3693
parent 47216 71c04702a3d5
equal deleted inserted replaced
56541:92cbbfc996f3 56542:56aaa6cb3693
    52 import java.security.cert.CertificateFactory;
    52 import java.security.cert.CertificateFactory;
    53 import java.security.spec.*;
    53 import java.security.spec.*;
    54 import java.security.interfaces.*;
    54 import java.security.interfaces.*;
    55 import java.util.Base64;
    55 import java.util.Base64;
    56 
    56 
    57 
    57 // Note: this test case works only on TLS 1.2 and prior versions because of
       
    58 // the use of MD5withRSA signed certificate.
    58 public class SSLSocketSNISensitive {
    59 public class SSLSocketSNISensitive {
    59 
    60 
    60     /*
    61     /*
    61      * =============================================================
    62      * =============================================================
    62      * Set the various variables needed for the tests, then
    63      * Set the various variables needed for the tests, then
   413 
   414 
   414         // create SSL context
   415         // create SSL context
   415         TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlgorithm);
   416         TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlgorithm);
   416         tmf.init(ks);
   417         tmf.init(ks);
   417 
   418 
   418         SSLContext ctx = SSLContext.getInstance("TLS");
   419         SSLContext ctx = SSLContext.getInstance("TLSv1.2");
   419         KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
   420         KeyManagerFactory kmf = KeyManagerFactory.getInstance("NewSunX509");
   420         kmf.init(ks, passphrase);
   421         kmf.init(ks, passphrase);
   421 
   422 
   422         ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
   423         ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
   423         ks = null;
   424         ks = null;