1 /* |
1 /* |
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2010, 2015, 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. |
34 public class TestRSAKeyLength extends PKCS11Test { |
34 public class TestRSAKeyLength extends PKCS11Test { |
35 public static void main(String[] args) throws Exception { |
35 public static void main(String[] args) throws Exception { |
36 main(new TestRSAKeyLength()); |
36 main(new TestRSAKeyLength()); |
37 } |
37 } |
38 public void main(Provider p) throws Exception { |
38 public void main(Provider p) throws Exception { |
|
39 |
|
40 /* |
|
41 * Use Solaris SPARC 11.2 or later to avoid an intermittent failure |
|
42 * when running SunPKCS11-Solaris (8044554) |
|
43 */ |
|
44 if (p.getName().equals("SunPKCS11-Solaris") && |
|
45 System.getProperty("os.name").equals("SunOS") && |
|
46 System.getProperty("os.arch").equals("sparcv9") && |
|
47 System.getProperty("os.version").compareTo("5.11") <= 0 && |
|
48 getDistro().compareTo("11.2") < 0) { |
|
49 |
|
50 System.out.println("SunPKCS11-Solaris provider requires " + |
|
51 "Solaris SPARC 11.2 or later, skipping"); |
|
52 return; |
|
53 } |
|
54 |
39 boolean isValidKeyLength[] = { true, true, true, false, false }; |
55 boolean isValidKeyLength[] = { true, true, true, false, false }; |
40 String algos[] = { "SHA1withRSA", "SHA224withRSA", "SHA256withRSA", |
56 String algos[] = { "SHA1withRSA", "SHA224withRSA", "SHA256withRSA", |
41 "SHA384withRSA", "SHA512withRSA" }; |
57 "SHA384withRSA", "SHA512withRSA" }; |
42 KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); |
58 KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p); |
43 kpg.initialize(512); |
59 kpg.initialize(512); |