1 /* |
1 /* |
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
26 * @bug 6316539 |
26 * @bug 6316539 |
27 * @summary Basic tests for TlsRsaPremasterSecret generator |
27 * @summary Basic tests for TlsRsaPremasterSecret generator |
28 * @author Andreas Sterbenz |
28 * @author Andreas Sterbenz |
29 * @library .. |
29 * @library .. |
30 * @modules java.base/sun.security.internal.spec |
30 * @modules java.base/sun.security.internal.spec |
|
31 * @run main/othervm TestPremaster |
|
32 * @run main/othervm TestPremaster sm policy |
31 */ |
33 */ |
32 |
34 |
33 import java.security.Security; |
|
34 import java.security.Provider; |
35 import java.security.Provider; |
35 |
|
36 import javax.crypto.KeyGenerator; |
36 import javax.crypto.KeyGenerator; |
37 import javax.crypto.SecretKey; |
37 import javax.crypto.SecretKey; |
38 import java.util.Formatter; |
|
39 |
|
40 import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; |
38 import sun.security.internal.spec.TlsRsaPremasterSecretParameterSpec; |
41 |
39 |
42 public class TestPremaster extends PKCS11Test { |
40 public class TestPremaster extends PKCS11Test { |
43 |
41 |
44 public static void main(String[] args) throws Exception { |
42 public static void main(String[] args) throws Exception { |
45 main(new TestPremaster()); |
43 main(new TestPremaster(), args); |
46 } |
44 } |
47 |
45 |
|
46 @Override |
48 public void main(Provider provider) throws Exception { |
47 public void main(Provider provider) throws Exception { |
49 if (provider.getService( |
48 if (provider.getService( |
50 "KeyGenerator", "SunTlsRsaPremasterSecret") == null) { |
49 "KeyGenerator", "SunTlsRsaPremasterSecret") == null) { |
51 System.out.println("Not supported by provider, skipping"); |
50 System.out.println("Not supported by provider, skipping"); |
52 return; |
51 return; |