40 * TLSv1.1 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA |
40 * TLSv1.1 TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA |
41 */ |
41 */ |
42 |
42 |
43 import java.io.InputStream; |
43 import java.io.InputStream; |
44 import java.io.OutputStream; |
44 import java.io.OutputStream; |
|
45 import java.security.MessageDigest; |
45 import java.security.Security; |
46 import java.security.Security; |
46 import javax.net.ssl.SSLSocket; |
47 import javax.net.ssl.SSLSocket; |
47 |
48 |
48 public class HandshakeHashCloneExhaustion extends SSLSocketTemplate { |
49 public class HandshakeHashCloneExhaustion extends SSLSocketTemplate { |
49 |
50 |
50 private static String[] protocol; |
51 private static String[] protocol; |
51 private static String[] ciphersuite; |
52 private static String[] ciphersuite; |
|
53 private static String[] mds = { "SHA", "MD5", "SHA-256" }; |
52 |
54 |
53 /* |
55 /* |
54 * ================== |
56 * ================== |
55 * Run the test case. |
57 * Run the test case. |
56 */ |
58 */ |
57 public static void main(String[] args) throws Exception { |
59 public static void main(String[] args) throws Exception { |
58 // Add in a non-cloneable MD5/SHA1/SHA-256 implementation |
60 // Add in a non-cloneable MD5/SHA1/SHA-256 implementation |
59 Security.insertProviderAt(new MyProvider(), 1); |
61 Security.insertProviderAt(new MyProvider(), 1); |
|
62 // make sure our provider is functioning |
|
63 for (String s : mds) { |
|
64 MessageDigest md = MessageDigest.getInstance(s); |
|
65 String p = md.getProvider().getName(); |
|
66 if (!p.equals("MyProvider")) { |
|
67 throw new RuntimeException("Unexpected provider: " + p); |
|
68 } |
|
69 } |
60 |
70 |
61 if (args.length != 2) { |
71 if (args.length != 2) { |
62 throw new Exception( |
72 throw new Exception( |
63 "Usage: HandshakeHashCloneExhaustion protocol ciphersuite"); |
73 "Usage: HandshakeHashCloneExhaustion protocol ciphersuite"); |
64 } |
74 } |