author | jjiang |
Wed, 15 Aug 2018 18:41:18 +0800 | |
changeset 51460 | 97e361fe3433 |
parent 51361 | 2afc9aa349ed |
child 51944 | 28085dba5d9a |
permissions | -rw-r--r-- |
2 | 1 |
/* |
48547
7537c762d42d
8194864: Outputs more details for PKCS11 tests if the NSS lib version cannot be determined
jjiang
parents:
48248
diff
changeset
|
2 |
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
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 |
|
7 |
* published by the Free Software Foundation. |
|
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 |
* |
|
5506 | 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. |
|
2 | 22 |
*/ |
23 |
||
24 |
||
25 |
// common infrastructure for SunPKCS11 tests |
|
26 |
||
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
27 |
import java.io.BufferedReader; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
28 |
import java.io.ByteArrayOutputStream; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
29 |
import java.io.File; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
30 |
import java.io.FileInputStream; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
31 |
import java.io.IOException; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
32 |
import java.io.InputStreamReader; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
33 |
import java.io.StringReader; |
48665
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
34 |
import java.nio.charset.StandardCharsets; |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
35 |
import java.security.AlgorithmParameters; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
36 |
import java.security.InvalidAlgorithmParameterException; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
37 |
import java.security.KeyPairGenerator; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
38 |
import java.security.NoSuchProviderException; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
39 |
import java.security.Provider; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
40 |
import java.security.ProviderException; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
41 |
import java.security.Security; |
21977
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
42 |
import java.security.spec.ECGenParameterSpec; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
43 |
import java.security.spec.ECParameterSpec; |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
44 |
import java.util.ArrayList; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
45 |
import java.util.Arrays; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
46 |
import java.util.HashMap; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
47 |
import java.util.Iterator; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
48 |
import java.util.List; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
49 |
import java.util.Map; |
50731 | 50 |
import java.util.Optional; |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
51 |
import java.util.Properties; |
41556
0c49ded763a8
8168078: Remove permission to read all system properties granted to the jdk.crypto.ec module
mullan
parents:
41485
diff
changeset
|
52 |
import java.util.ServiceConfigurationError; |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
53 |
import java.util.ServiceLoader; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
54 |
import java.util.Set; |
2 | 55 |
|
51460
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
56 |
import jdk.test.lib.artifacts.Artifact; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
57 |
import jdk.test.lib.artifacts.ArtifactResolver; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
58 |
import jdk.test.lib.artifacts.ArtifactResolverException; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
59 |
|
2 | 60 |
public abstract class PKCS11Test { |
61 |
||
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
62 |
private boolean enableSM = false; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
63 |
|
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
64 |
static final Properties props = System.getProperties(); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
65 |
|
32635
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
66 |
static final String PKCS11 = "PKCS11"; |
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
67 |
|
2 | 68 |
// directory of the test source |
69 |
static final String BASE = System.getProperty("test.src", "."); |
|
70 |
||
71 |
static final char SEP = File.separatorChar; |
|
72 |
||
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
73 |
private static final String DEFAULT_POLICY = |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
74 |
BASE + SEP + ".." + SEP + "policy"; |
2 | 75 |
|
76 |
// directory corresponding to BASE in the /closed hierarchy |
|
77 |
static final String CLOSED_BASE; |
|
78 |
||
79 |
static { |
|
80 |
// hack |
|
81 |
String absBase = new File(BASE).getAbsolutePath(); |
|
82 |
int k = absBase.indexOf(SEP + "test" + SEP + "sun" + SEP); |
|
83 |
if (k < 0) k = 0; |
|
84 |
String p1 = absBase.substring(0, k + 6); |
|
85 |
String p2 = absBase.substring(k + 5); |
|
86 |
CLOSED_BASE = p1 + "closed" + p2; |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
87 |
|
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
88 |
// set it as a system property to make it available in policy file |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
89 |
System.setProperty("closed.base", CLOSED_BASE); |
2 | 90 |
} |
91 |
||
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
92 |
// NSS version info |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
93 |
public static enum ECCState { None, Basic, Extended }; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
94 |
static double nss_version = -1; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
95 |
static ECCState nss_ecc_status = ECCState.Extended; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
96 |
|
19066 | 97 |
// The NSS library we need to search for in getNSSLibDir() |
98 |
// Default is "libsoftokn3.so", listed as "softokn3" |
|
99 |
// The other is "libnss3.so", listed as "nss3". |
|
100 |
static String nss_library = "softokn3"; |
|
101 |
||
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
102 |
// NSS versions of each library. It is simplier to keep nss_version |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
103 |
// for quick checking for generic testing than many if-else statements. |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
104 |
static double softoken3_version = -1; |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
105 |
static double nss3_version = -1; |
31270
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
106 |
static Provider pkcs11; |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
107 |
|
31270
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
108 |
// Goes through ServiceLoader instead of Provider.getInstance() since it |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
109 |
// works on all platforms |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
110 |
static { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
111 |
ServiceLoader sl = ServiceLoader.load(java.security.Provider.class); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
112 |
Iterator<Provider> iter = sl.iterator(); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
113 |
Provider p = null; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
114 |
boolean found = false; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
115 |
while (iter.hasNext()) { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
116 |
try { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
117 |
p = iter.next(); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
118 |
if (p.getName().equals("SunPKCS11")) { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
119 |
found = true; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
120 |
break; |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
121 |
} |
41556
0c49ded763a8
8168078: Remove permission to read all system properties granted to the jdk.crypto.ec module
mullan
parents:
41485
diff
changeset
|
122 |
} catch (Exception | ServiceConfigurationError e) { |
31270
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
123 |
// ignore and move on to the next one |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
124 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
125 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
126 |
// Nothing found through ServiceLoader; fall back to reflection |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
127 |
if (!found) { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
128 |
try { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
129 |
Class clazz = Class.forName("sun.security.pkcs11.SunPKCS11"); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
130 |
p = (Provider) clazz.newInstance(); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
131 |
} catch (Exception ex) { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
132 |
ex.printStackTrace(); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
133 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
134 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
135 |
pkcs11 = p; |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
136 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
137 |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
138 |
/* |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
139 |
* Use Solaris SPARC 11.2 or later to avoid an intermittent failure |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
140 |
* when running SunPKCS11-Solaris (8044554) |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
141 |
*/ |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
142 |
static boolean isBadSolarisSparc(Provider p) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
143 |
if ("SunPKCS11-Solaris".equals(p.getName()) && badSolarisSparc) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
144 |
System.out.println("SunPKCS11-Solaris provider requires " + |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
145 |
"Solaris SPARC 11.2 or later, skipping"); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
146 |
return true; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
147 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
148 |
return false; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
149 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
150 |
|
31270
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
151 |
// Return a SunPKCS11 provider configured with the specified config file |
2 | 152 |
static Provider getSunPKCS11(String config) throws Exception { |
31270
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
153 |
if (pkcs11 == null) { |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
154 |
throw new NoSuchProviderException("No PKCS11 provider available"); |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
155 |
} |
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
156 |
return pkcs11.configure(config); |
2 | 157 |
} |
158 |
||
159 |
public abstract void main(Provider p) throws Exception; |
|
160 |
||
51245
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
161 |
protected boolean skipTest(Provider p) { |
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
162 |
return false; |
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
163 |
} |
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
164 |
|
2 | 165 |
private void premain(Provider p) throws Exception { |
51245
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
166 |
if (skipTest(p)) { |
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
167 |
return; |
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
168 |
} |
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
169 |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
170 |
// set a security manager and policy before a test case runs, |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
171 |
// and disable them after the test case finished |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
172 |
try { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
173 |
if (enableSM) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
174 |
System.setSecurityManager(new SecurityManager()); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
175 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
176 |
long start = System.currentTimeMillis(); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
177 |
System.out.printf( |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
178 |
"Running test with provider %s (security manager %s) ...%n", |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
179 |
p.getName(), enableSM ? "enabled" : "disabled"); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
180 |
main(p); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
181 |
long stop = System.currentTimeMillis(); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
182 |
System.out.println("Completed test with provider " + p.getName() + |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
183 |
" (" + (stop - start) + " ms)."); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
184 |
} finally { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
185 |
if (enableSM) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
186 |
System.setSecurityManager(null); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
187 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
188 |
} |
2 | 189 |
} |
190 |
||
191 |
public static void main(PKCS11Test test) throws Exception { |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
192 |
main(test, null); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
193 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
194 |
|
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
195 |
public static void main(PKCS11Test test, String[] args) throws Exception { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
196 |
if (args != null) { |
37353
e8e684b89c81
8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux
amjiang
parents:
36249
diff
changeset
|
197 |
if (args.length > 0) { |
e8e684b89c81
8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux
amjiang
parents:
36249
diff
changeset
|
198 |
if ("sm".equals(args[0])) { |
e8e684b89c81
8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux
amjiang
parents:
36249
diff
changeset
|
199 |
test.enableSM = true; |
e8e684b89c81
8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux
amjiang
parents:
36249
diff
changeset
|
200 |
} else { |
e8e684b89c81
8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux
amjiang
parents:
36249
diff
changeset
|
201 |
throw new RuntimeException("Unknown Command, use 'sm' as " |
e8e684b89c81
8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux
amjiang
parents:
36249
diff
changeset
|
202 |
+ "first arguemtn to enable security manager"); |
e8e684b89c81
8153545: sun/security/pkcs11/Provider/Login.sh fails on Linux
amjiang
parents:
36249
diff
changeset
|
203 |
} |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
204 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
205 |
if (test.enableSM) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
206 |
System.setProperty("java.security.policy", |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
207 |
(args.length > 1) ? BASE + SEP + args[1] |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
208 |
: DEFAULT_POLICY); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
209 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
210 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
211 |
|
10328 | 212 |
Provider[] oldProviders = Security.getProviders(); |
213 |
try { |
|
214 |
System.out.println("Beginning test run " + test.getClass().getName() + "..."); |
|
215 |
testDefault(test); |
|
216 |
testNSS(test); |
|
217 |
testDeimos(test); |
|
218 |
} finally { |
|
19066 | 219 |
// NOTE: Do not place a 'return' in any finally block |
220 |
// as it will suppress exceptions and hide test failures. |
|
10328 | 221 |
Provider[] newProviders = Security.getProviders(); |
19066 | 222 |
boolean found = true; |
10328 | 223 |
// Do not restore providers if nothing changed. This is especailly |
224 |
// useful for ./Provider/Login.sh, where a SecurityManager exists. |
|
225 |
if (oldProviders.length == newProviders.length) { |
|
19066 | 226 |
found = false; |
10328 | 227 |
for (int i = 0; i<oldProviders.length; i++) { |
228 |
if (oldProviders[i] != newProviders[i]) { |
|
229 |
found = true; |
|
230 |
break; |
|
231 |
} |
|
232 |
} |
|
233 |
} |
|
19066 | 234 |
if (found) { |
235 |
for (Provider p: newProviders) { |
|
236 |
Security.removeProvider(p.getName()); |
|
237 |
} |
|
238 |
for (Provider p: oldProviders) { |
|
239 |
Security.addProvider(p); |
|
240 |
} |
|
10328 | 241 |
} |
242 |
} |
|
2 | 243 |
} |
244 |
||
245 |
public static void testDeimos(PKCS11Test test) throws Exception { |
|
246 |
if (new File("/opt/SUNWconn/lib/libpkcs11.so").isFile() == false || |
|
247 |
"true".equals(System.getProperty("NO_DEIMOS"))) { |
|
248 |
return; |
|
249 |
} |
|
250 |
String base = getBase(); |
|
251 |
String p11config = base + SEP + "nss" + SEP + "p11-deimos.txt"; |
|
252 |
Provider p = getSunPKCS11(p11config); |
|
253 |
test.premain(p); |
|
254 |
} |
|
255 |
||
256 |
public static void testDefault(PKCS11Test test) throws Exception { |
|
257 |
// run test for default configured PKCS11 providers (if any) |
|
258 |
||
259 |
if ("true".equals(System.getProperty("NO_DEFAULT"))) { |
|
260 |
return; |
|
261 |
} |
|
262 |
||
263 |
Provider[] providers = Security.getProviders(); |
|
264 |
for (int i = 0; i < providers.length; i++) { |
|
265 |
Provider p = providers[i]; |
|
266 |
if (p.getName().startsWith("SunPKCS11-")) { |
|
267 |
test.premain(p); |
|
268 |
} |
|
269 |
} |
|
270 |
} |
|
271 |
||
272 |
private static String PKCS11_BASE; |
|
12294
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
273 |
static { |
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
274 |
try { |
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
275 |
PKCS11_BASE = getBase(); |
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
276 |
} catch (Exception e) { |
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
277 |
// ignore |
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
278 |
} |
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
279 |
} |
2 | 280 |
|
281 |
private final static String PKCS11_REL_PATH = "sun/security/pkcs11"; |
|
282 |
||
283 |
public static String getBase() throws Exception { |
|
284 |
if (PKCS11_BASE != null) { |
|
285 |
return PKCS11_BASE; |
|
286 |
} |
|
287 |
File cwd = new File(System.getProperty("test.src", ".")).getCanonicalFile(); |
|
288 |
while (true) { |
|
289 |
File file = new File(cwd, "TEST.ROOT"); |
|
290 |
if (file.isFile()) { |
|
291 |
break; |
|
292 |
} |
|
293 |
cwd = cwd.getParentFile(); |
|
294 |
if (cwd == null) { |
|
295 |
throw new Exception("Test root directory not found"); |
|
296 |
} |
|
297 |
} |
|
298 |
PKCS11_BASE = new File(cwd, PKCS11_REL_PATH.replace('/', SEP)).getAbsolutePath(); |
|
299 |
return PKCS11_BASE; |
|
300 |
} |
|
301 |
||
302 |
public static String getNSSLibDir() throws Exception { |
|
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
303 |
return getNSSLibDir(nss_library); |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
304 |
} |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
305 |
|
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
306 |
static String getNSSLibDir(String library) throws Exception { |
51460
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
307 |
String osid = getOsId(); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
308 |
String[] nssLibDirs = getNssLibPaths(osid); |
13565
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
309 |
if (nssLibDirs == null) { |
41485
15a87b8ccd06
8164322: Test sun/security/pkcs11/PKCS11Test.java shall be updated to run on ARM platforms
tidu
parents:
40942
diff
changeset
|
310 |
System.out.println("Warning: unsupported OS: " + osid |
15a87b8ccd06
8164322: Test sun/security/pkcs11/PKCS11Test.java shall be updated to run on ARM platforms
tidu
parents:
40942
diff
changeset
|
311 |
+ ", please initialize NSS librarys location firstly, skipping test"); |
2 | 312 |
return null; |
313 |
} |
|
13565
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
314 |
if (nssLibDirs.length == 0) { |
41485
15a87b8ccd06
8164322: Test sun/security/pkcs11/PKCS11Test.java shall be updated to run on ARM platforms
tidu
parents:
40942
diff
changeset
|
315 |
System.out.println("Warning: NSS not supported on this platform, skipping test"); |
2 | 316 |
return null; |
317 |
} |
|
13565
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
318 |
String nssLibDir = null; |
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
319 |
for (String dir : nssLibDirs) { |
19066 | 320 |
if (new File(dir).exists() && |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
321 |
new File(dir + System.mapLibraryName(library)).exists()) { |
13565
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
322 |
nssLibDir = dir; |
51460
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
323 |
System.out.println("nssLibDir: " + nssLibDir); |
13565
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
324 |
System.setProperty("pkcs11test.nss.libdir", nssLibDir); |
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
325 |
break; |
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
326 |
} |
6298d600104f
7190945: pkcs11 problem loading NSS libs on Ubuntu
vinnie
parents:
13250
diff
changeset
|
327 |
} |
41485
15a87b8ccd06
8164322: Test sun/security/pkcs11/PKCS11Test.java shall be updated to run on ARM platforms
tidu
parents:
40942
diff
changeset
|
328 |
if (nssLibDir == null) { |
15a87b8ccd06
8164322: Test sun/security/pkcs11/PKCS11Test.java shall be updated to run on ARM platforms
tidu
parents:
40942
diff
changeset
|
329 |
System.out.println("Warning: can't find NSS librarys on this machine, skipping test"); |
15a87b8ccd06
8164322: Test sun/security/pkcs11/PKCS11Test.java shall be updated to run on ARM platforms
tidu
parents:
40942
diff
changeset
|
330 |
return null; |
15a87b8ccd06
8164322: Test sun/security/pkcs11/PKCS11Test.java shall be updated to run on ARM platforms
tidu
parents:
40942
diff
changeset
|
331 |
} |
12294
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
332 |
return nssLibDir; |
2 | 333 |
} |
334 |
||
51460
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
335 |
private static String getOsId() { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
336 |
String osName = props.getProperty("os.name"); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
337 |
if (osName.startsWith("Win")) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
338 |
osName = "Windows"; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
339 |
} else if (osName.equals("Mac OS X")) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
340 |
osName = "MacOSX"; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
341 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
342 |
String osid = osName + "-" + props.getProperty("os.arch") + "-" |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
343 |
+ props.getProperty("sun.arch.data.model"); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
344 |
return osid; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
345 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
346 |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
347 |
static boolean isBadNSSVersion(Provider p) { |
51245
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
348 |
double nssVersion = getNSSVersion(); |
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
349 |
if (isNSS(p) && nssVersion >= 3.11 && nssVersion < 3.12) { |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
350 |
System.out.println("NSS 3.11 has a DER issue that recent " + |
51245
f095e3bc2d41
8206258: [Test Error] sun/security/pkcs11 tests fail if NSS libs not found
jjiang
parents:
51213
diff
changeset
|
351 |
"version do not, skipping"); |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
352 |
return true; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
353 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
354 |
return false; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
355 |
} |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
356 |
|
10328 | 357 |
protected static void safeReload(String lib) throws Exception { |
358 |
try { |
|
359 |
System.load(lib); |
|
360 |
} catch (UnsatisfiedLinkError e) { |
|
361 |
if (e.getMessage().contains("already loaded")) { |
|
362 |
return; |
|
363 |
} |
|
364 |
} |
|
365 |
} |
|
366 |
||
2 | 367 |
static boolean loadNSPR(String libdir) throws Exception { |
368 |
// load NSS softoken dependencies in advance to avoid resolver issues |
|
40942
7a81fdff5752
8077138: Some PKCS11 tests fail because NSS library is not initialized
jjiang
parents:
37353
diff
changeset
|
369 |
safeReload(libdir + System.mapLibraryName("nspr4")); |
7a81fdff5752
8077138: Some PKCS11 tests fail because NSS library is not initialized
jjiang
parents:
37353
diff
changeset
|
370 |
safeReload(libdir + System.mapLibraryName("plc4")); |
7a81fdff5752
8077138: Some PKCS11 tests fail because NSS library is not initialized
jjiang
parents:
37353
diff
changeset
|
371 |
safeReload(libdir + System.mapLibraryName("plds4")); |
12294
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
372 |
safeReload(libdir + System.mapLibraryName("sqlite3")); |
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
373 |
safeReload(libdir + System.mapLibraryName("nssutil3")); |
2 | 374 |
return true; |
375 |
} |
|
376 |
||
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
377 |
// Check the provider being used is NSS |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
378 |
public static boolean isNSS(Provider p) { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
379 |
return p.getName().toUpperCase().equals("SUNPKCS11-NSS"); |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
380 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
381 |
|
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
382 |
static double getNSSVersion() { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
383 |
if (nss_version == -1) |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
384 |
getNSSInfo(); |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
385 |
return nss_version; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
386 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
387 |
|
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
388 |
static ECCState getNSSECC() { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
389 |
if (nss_version == -1) |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
390 |
getNSSInfo(); |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
391 |
return nss_ecc_status; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
392 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
393 |
|
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
394 |
public static double getLibsoftokn3Version() { |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
395 |
if (softoken3_version == -1) |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
396 |
return getNSSInfo("softokn3"); |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
397 |
return softoken3_version; |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
398 |
} |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
399 |
|
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
400 |
public static double getLibnss3Version() { |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
401 |
if (nss3_version == -1) |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
402 |
return getNSSInfo("nss3"); |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
403 |
return nss3_version; |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
404 |
} |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
405 |
|
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
406 |
/* Read the library to find out the verison */ |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
407 |
static void getNSSInfo() { |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
408 |
getNSSInfo(nss_library); |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
409 |
} |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
410 |
|
48665
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
411 |
// Try to parse the version for the specified library. |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
412 |
// Assuming the library contains either of the following patterns: |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
413 |
// $Header: NSS <version> |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
414 |
// Version: NSS <version> |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
415 |
// Here, <version> stands for NSS version. |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
416 |
static double getNSSInfo(String library) { |
36249
8b92e4bedbd4
8138653: Default key sizes for the AlgorithmParameterGenerator and KeyPairGenerator implementations should be upgraded
mullan
parents:
35379
diff
changeset
|
417 |
// look for two types of headers in NSS libraries |
8b92e4bedbd4
8138653: Default key sizes for the AlgorithmParameterGenerator and KeyPairGenerator implementations should be upgraded
mullan
parents:
35379
diff
changeset
|
418 |
String nssHeader1 = "$Header: NSS"; |
8b92e4bedbd4
8138653: Default key sizes for the AlgorithmParameterGenerator and KeyPairGenerator implementations should be upgraded
mullan
parents:
35379
diff
changeset
|
419 |
String nssHeader2 = "Version: NSS"; |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
420 |
boolean found = false; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
421 |
String s = null; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
422 |
int i = 0; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
423 |
String libfile = ""; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
424 |
|
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
425 |
if (library.compareTo("softokn3") == 0 && softoken3_version > -1) |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
426 |
return softoken3_version; |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
427 |
if (library.compareTo("nss3") == 0 && nss3_version > -1) |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
428 |
return nss3_version; |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
429 |
|
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
430 |
try { |
51213 | 431 |
String libdir = getNSSLibDir(); |
432 |
if (libdir == null) { |
|
433 |
return 0.0; |
|
434 |
} |
|
435 |
libfile = libdir + System.mapLibraryName(library); |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
436 |
try (FileInputStream is = new FileInputStream(libfile)) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
437 |
byte[] data = new byte[1000]; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
438 |
int read = 0; |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
439 |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
440 |
while (is.available() > 0) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
441 |
if (read == 0) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
442 |
read = is.read(data, 0, 1000); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
443 |
} else { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
444 |
// Prepend last 100 bytes in case the header was split |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
445 |
// between the reads. |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
446 |
System.arraycopy(data, 900, data, 0, 100); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
447 |
read = 100 + is.read(data, 100, 900); |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
448 |
} |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
449 |
|
48665
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
450 |
s = new String(data, 0, read, StandardCharsets.US_ASCII); |
36249
8b92e4bedbd4
8138653: Default key sizes for the AlgorithmParameterGenerator and KeyPairGenerator implementations should be upgraded
mullan
parents:
35379
diff
changeset
|
451 |
i = s.indexOf(nssHeader1); |
8b92e4bedbd4
8138653: Default key sizes for the AlgorithmParameterGenerator and KeyPairGenerator implementations should be upgraded
mullan
parents:
35379
diff
changeset
|
452 |
if (i > 0 || (i = s.indexOf(nssHeader2)) > 0) { |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
453 |
found = true; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
454 |
// If the nssHeader is before 920 we can break, otherwise |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
455 |
// we may not have the whole header so do another read. If |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
456 |
// no bytes are in the stream, that is ok, found is true. |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
457 |
if (i < 920) { |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
458 |
break; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
459 |
} |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
460 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
461 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
462 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
463 |
} catch (Exception e) { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
464 |
e.printStackTrace(); |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
465 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
466 |
|
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
467 |
if (!found) { |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
468 |
System.out.println("lib" + library + |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
469 |
" version not found, set to 0.0: " + libfile); |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
470 |
nss_version = 0.0; |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
471 |
return nss_version; |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
472 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
473 |
|
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
474 |
// the index after whitespace after nssHeader |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
475 |
int afterheader = s.indexOf("NSS", i) + 4; |
48665
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
476 |
String version = String.valueOf(s.charAt(afterheader)); |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
477 |
for (char c = s.charAt(++afterheader); |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
478 |
c == '.' || (c >= '0' && c <= '9'); |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
479 |
c = s.charAt(++afterheader)) { |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
480 |
version += c; |
48547
7537c762d42d
8194864: Outputs more details for PKCS11 tests if the NSS lib version cannot be determined
jjiang
parents:
48248
diff
changeset
|
481 |
} |
7537c762d42d
8194864: Outputs more details for PKCS11 tests if the NSS lib version cannot be determined
jjiang
parents:
48248
diff
changeset
|
482 |
|
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
483 |
// If a "dot dot" release, strip the extra dots for double parsing |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
484 |
String[] dot = version.split("\\."); |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
485 |
if (dot.length > 2) { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
486 |
version = dot[0]+"."+dot[1]; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
487 |
for (int j = 2; dot.length > j; j++) { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
488 |
version += dot[j]; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
489 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
490 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
491 |
|
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
492 |
// Convert to double for easier version value checking |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
493 |
try { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
494 |
nss_version = Double.parseDouble(version); |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
495 |
} catch (NumberFormatException e) { |
48665
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
496 |
System.out.println("===== Content start ====="); |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
497 |
System.out.println(s); |
257d7610663f
8186098: sun/security/pkcs11/KeyStore/SecretKeysBasic.sh failed due to libnss3 version cannot be parsed
jjiang
parents:
48608
diff
changeset
|
498 |
System.out.println("===== Content end ====="); |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
499 |
System.out.println("Failed to parse lib" + library + |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
500 |
" version. Set to 0.0"); |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
501 |
e.printStackTrace(); |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
502 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
503 |
|
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
504 |
System.out.print("lib" + library + " version = "+version+". "); |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
505 |
|
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
506 |
// Check for ECC |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
507 |
if (s.indexOf("Basic") > 0) { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
508 |
nss_ecc_status = ECCState.Basic; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
509 |
System.out.println("ECC Basic."); |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
510 |
} else if (s.indexOf("Extended") > 0) { |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
511 |
nss_ecc_status = ECCState.Extended; |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
512 |
System.out.println("ECC Extended."); |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
513 |
} else { |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
514 |
System.out.println("ECC None."); |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
515 |
} |
24863
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
516 |
|
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
517 |
if (library.compareTo("softokn3") == 0) { |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
518 |
softoken3_version = nss_version; |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
519 |
} else if (library.compareTo("nss3") == 0) { |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
520 |
nss3_version = nss_version; |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
521 |
} |
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
522 |
|
bf6df3caafe4
8039212: SecretKeyBasic.sh needs to avoid NSS libnss3 and libsoftokn3 version mismatches
ascarpino
parents:
24629
diff
changeset
|
523 |
return nss_version; |
19067
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
524 |
} |
5271291b7121
8020424: The NSS version should be detected before running crypto tests
ascarpino
parents:
19066
diff
changeset
|
525 |
|
19066 | 526 |
// Used to set the nss_library file to search for libsoftokn3.so |
527 |
public static void useNSS() { |
|
528 |
nss_library = "nss3"; |
|
529 |
} |
|
530 |
||
2 | 531 |
public static void testNSS(PKCS11Test test) throws Exception { |
532 |
String libdir = getNSSLibDir(); |
|
533 |
if (libdir == null) { |
|
534 |
return; |
|
535 |
} |
|
536 |
String base = getBase(); |
|
537 |
||
538 |
if (loadNSPR(libdir) == false) { |
|
539 |
return; |
|
540 |
} |
|
541 |
||
19066 | 542 |
String libfile = libdir + System.mapLibraryName(nss_library); |
2 | 543 |
|
544 |
String customDBdir = System.getProperty("CUSTOM_DB_DIR"); |
|
545 |
String dbdir = (customDBdir != null) ? |
|
546 |
customDBdir : |
|
547 |
base + SEP + "nss" + SEP + "db"; |
|
548 |
// NSS always wants forward slashes for the config path |
|
549 |
dbdir = dbdir.replace('\\', '/'); |
|
550 |
||
551 |
String customConfig = System.getProperty("CUSTOM_P11_CONFIG"); |
|
552 |
String customConfigName = System.getProperty("CUSTOM_P11_CONFIG_NAME", "p11-nss.txt"); |
|
553 |
String p11config = (customConfig != null) ? |
|
554 |
customConfig : |
|
555 |
base + SEP + "nss" + SEP + customConfigName; |
|
556 |
||
557 |
System.setProperty("pkcs11test.nss.lib", libfile); |
|
558 |
System.setProperty("pkcs11test.nss.db", dbdir); |
|
559 |
Provider p = getSunPKCS11(p11config); |
|
560 |
test.premain(p); |
|
561 |
} |
|
562 |
||
21977
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
563 |
// Generate a vector of supported elliptic curves of a given provider |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
564 |
static List<ECParameterSpec> getKnownCurves(Provider p) throws Exception { |
21977
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
565 |
int index; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
566 |
int begin; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
567 |
int end; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
568 |
String curve; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
569 |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
570 |
List<ECParameterSpec> results = new ArrayList<>(); |
21977
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
571 |
// Get Curves to test from SunEC. |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
572 |
String kcProp = Security.getProvider("SunEC"). |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
573 |
getProperty("AlgorithmParameters.EC SupportedCurves"); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
574 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
575 |
if (kcProp == null) { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
576 |
throw new RuntimeException( |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
577 |
"\"AlgorithmParameters.EC SupportedCurves property\" not found"); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
578 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
579 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
580 |
System.out.println("Finding supported curves using list from SunEC\n"); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
581 |
index = 0; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
582 |
for (;;) { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
583 |
// Each set of curve names is enclosed with brackets. |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
584 |
begin = kcProp.indexOf('[', index); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
585 |
end = kcProp.indexOf(']', index); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
586 |
if (begin == -1 || end == -1) { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
587 |
break; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
588 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
589 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
590 |
/* |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
591 |
* Each name is separated by a comma. |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
592 |
* Just get the first name in the set. |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
593 |
*/ |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
594 |
index = end + 1; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
595 |
begin++; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
596 |
end = kcProp.indexOf(',', begin); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
597 |
if (end == -1) { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
598 |
// Only one name in the set. |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
599 |
end = index -1; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
600 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
601 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
602 |
curve = kcProp.substring(begin, end); |
50731 | 603 |
getSupportedECParameterSpec(curve, p) |
604 |
.ifPresent(spec -> results.add(spec)); |
|
21977
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
605 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
606 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
607 |
if (results.size() == 0) { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
608 |
throw new RuntimeException("No supported EC curves found"); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
609 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
610 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
611 |
return results; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
612 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
613 |
|
50731 | 614 |
static Optional<ECParameterSpec> getSupportedECParameterSpec(String curve, |
615 |
Provider p) throws Exception { |
|
616 |
ECParameterSpec e = getECParameterSpec(p, curve); |
|
617 |
System.out.print("\t "+ curve + ": "); |
|
618 |
try { |
|
619 |
KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC", p); |
|
620 |
kpg.initialize(e); |
|
621 |
kpg.generateKeyPair(); |
|
622 |
System.out.println("Supported"); |
|
623 |
return Optional.of(e); |
|
624 |
} catch (ProviderException ex) { |
|
625 |
System.out.println("Unsupported: PKCS11: " + |
|
626 |
ex.getCause().getMessage()); |
|
627 |
return Optional.empty(); |
|
628 |
} catch (InvalidAlgorithmParameterException ex) { |
|
629 |
System.out.println("Unsupported: Key Length: " + |
|
630 |
ex.getMessage()); |
|
631 |
return Optional.empty(); |
|
632 |
} |
|
633 |
} |
|
634 |
||
21977
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
635 |
private static ECParameterSpec getECParameterSpec(Provider p, String name) |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
636 |
throws Exception { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
637 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
638 |
AlgorithmParameters parameters = |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
639 |
AlgorithmParameters.getInstance("EC", p); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
640 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
641 |
parameters.init(new ECGenParameterSpec(name)); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
642 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
643 |
return parameters.getParameterSpec(ECParameterSpec.class); |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
644 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
645 |
|
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
646 |
// Check support for a curve with a provided Vector of EC support |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
647 |
boolean checkSupport(List<ECParameterSpec> supportedEC, |
21977
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
648 |
ECParameterSpec curve) { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
649 |
for (ECParameterSpec ec: supportedEC) { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
650 |
if (ec.equals(curve)) { |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
651 |
return true; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
652 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
653 |
} |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
654 |
return false; |
17f538f05b73
8027218: TEST_BUG: sun/security/pkcs11/ec tests fail because of ever-changing key size restrictions
ascarpino
parents:
19067
diff
changeset
|
655 |
} |
2 | 656 |
|
51460
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
657 |
private static Map<String,String[]> osMap; |
2 | 658 |
|
12294
f313586fc3cc
7152582: PKCS11 tests should use the NSS libraries available in the OS
vinnie
parents:
12042
diff
changeset
|
659 |
// Location of the NSS libraries on each supported platform |
51460
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
660 |
private static Map<String, String[]> getOsMap() { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
661 |
if (osMap != null) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
662 |
return osMap; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
663 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
664 |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
665 |
osMap = new HashMap<>(); |
51460
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
666 |
osMap.put("SunOS-sparc-32", new String[] { "/usr/lib/mps/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
667 |
osMap.put("SunOS-sparcv9-64", new String[] { "/usr/lib/mps/64/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
668 |
osMap.put("SunOS-x86-32", new String[] { "/usr/lib/mps/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
669 |
osMap.put("SunOS-amd64-64", new String[] { "/usr/lib/mps/64/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
670 |
osMap.put("Linux-i386-32", new String[] { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
671 |
"/usr/lib/i386-linux-gnu/", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
672 |
"/usr/lib32/", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
673 |
"/usr/lib/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
674 |
osMap.put("Linux-amd64-64", new String[] { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
675 |
"/usr/lib/x86_64-linux-gnu/", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
676 |
"/usr/lib/x86_64-linux-gnu/nss/", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
677 |
"/usr/lib64/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
678 |
osMap.put("Linux-ppc64-64", new String[] { "/usr/lib64/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
679 |
osMap.put("Linux-ppc64le-64", new String[] { "/usr/lib64/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
680 |
osMap.put("Linux-s390x-64", new String[] { "/usr/lib64/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
681 |
osMap.put("Windows-x86-32", new String[] {}); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
682 |
osMap.put("Windows-amd64-64", new String[] {}); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
683 |
osMap.put("MacOSX-x86_64-64", new String[] {}); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
684 |
osMap.put("Linux-arm-32", new String[] { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
685 |
"/usr/lib/arm-linux-gnueabi/nss/", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
686 |
"/usr/lib/arm-linux-gnueabihf/nss/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
687 |
osMap.put("Linux-aarch64-64", new String[] { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
688 |
"/usr/lib/aarch64-linux-gnu/", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
689 |
"/usr/lib/aarch64-linux-gnu/nss/" }); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
690 |
return osMap; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
691 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
692 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
693 |
private static String[] getNssLibPaths(String osId) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
694 |
String[] preferablePaths = getPreferableNssLibPaths(osId); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
695 |
if (preferablePaths.length != 0) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
696 |
return preferablePaths; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
697 |
} else { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
698 |
return getOsMap().get(osId); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
699 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
700 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
701 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
702 |
private static String[] getPreferableNssLibPaths(String osId) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
703 |
List<String> nssLibPaths = new ArrayList<>(); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
704 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
705 |
String customNssLibPaths = System.getProperty("test.nss.lib.paths"); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
706 |
if (customNssLibPaths == null) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
707 |
// If custom local NSS lib path is not provided, |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
708 |
// try to download NSS libs from artifactory |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
709 |
String path = fetchNssLib(osId); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
710 |
if (path != null) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
711 |
nssLibPaths.add(path); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
712 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
713 |
} else { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
714 |
String[] paths = customNssLibPaths.split(","); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
715 |
for (String path : paths) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
716 |
if (!path.endsWith(File.separator)) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
717 |
nssLibPaths.add(path + File.separator); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
718 |
} else { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
719 |
nssLibPaths.add(path); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
720 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
721 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
722 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
723 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
724 |
return nssLibPaths.toArray(new String[nssLibPaths.size()]); |
2 | 725 |
} |
726 |
||
727 |
private final static char[] hexDigits = "0123456789abcdef".toCharArray(); |
|
728 |
||
42366
b1483ec50db1
8170523: Some PKCS11 test cases are ignored with security manager
mli
parents:
41556
diff
changeset
|
729 |
private static final String distro = distro(); |
b1483ec50db1
8170523: Some PKCS11 test cases are ignored with security manager
mli
parents:
41556
diff
changeset
|
730 |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
731 |
static final boolean badSolarisSparc = |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
732 |
System.getProperty("os.name").equals("SunOS") && |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
733 |
System.getProperty("os.arch").equals("sparcv9") && |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
734 |
System.getProperty("os.version").compareTo("5.11") <= 0 && |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
735 |
getDistro().compareTo("11.2") < 0; |
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
736 |
|
2 | 737 |
public static String toString(byte[] b) { |
738 |
if (b == null) { |
|
739 |
return "(null)"; |
|
740 |
} |
|
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
741 |
StringBuilder sb = new StringBuilder(b.length * 3); |
2 | 742 |
for (int i = 0; i < b.length; i++) { |
743 |
int k = b[i] & 0xff; |
|
744 |
if (i != 0) { |
|
745 |
sb.append(':'); |
|
746 |
} |
|
747 |
sb.append(hexDigits[k >>> 4]); |
|
748 |
sb.append(hexDigits[k & 0xf]); |
|
749 |
} |
|
750 |
return sb.toString(); |
|
751 |
} |
|
752 |
||
753 |
public static byte[] parse(String s) { |
|
754 |
if (s.equals("(null)")) { |
|
755 |
return null; |
|
756 |
} |
|
757 |
try { |
|
758 |
int n = s.length(); |
|
759 |
ByteArrayOutputStream out = new ByteArrayOutputStream(n / 3); |
|
760 |
StringReader r = new StringReader(s); |
|
761 |
while (true) { |
|
762 |
int b1 = nextNibble(r); |
|
763 |
if (b1 < 0) { |
|
764 |
break; |
|
765 |
} |
|
766 |
int b2 = nextNibble(r); |
|
767 |
if (b2 < 0) { |
|
768 |
throw new RuntimeException("Invalid string " + s); |
|
769 |
} |
|
770 |
int b = (b1 << 4) | b2; |
|
771 |
out.write(b); |
|
772 |
} |
|
773 |
return out.toByteArray(); |
|
774 |
} catch (IOException e) { |
|
775 |
throw new RuntimeException(e); |
|
776 |
} |
|
777 |
} |
|
778 |
||
779 |
private static int nextNibble(StringReader r) throws IOException { |
|
780 |
while (true) { |
|
781 |
int ch = r.read(); |
|
782 |
if (ch == -1) { |
|
783 |
return -1; |
|
784 |
} else if ((ch >= '0') && (ch <= '9')) { |
|
785 |
return ch - '0'; |
|
786 |
} else if ((ch >= 'a') && (ch <= 'f')) { |
|
787 |
return ch - 'a' + 10; |
|
788 |
} else if ((ch >= 'A') && (ch <= 'F')) { |
|
789 |
return ch - 'A' + 10; |
|
790 |
} |
|
791 |
} |
|
792 |
} |
|
793 |
||
794 |
<T> T[] concat(T[] a, T[] b) { |
|
795 |
if ((b == null) || (b.length == 0)) { |
|
796 |
return a; |
|
797 |
} |
|
31270
e6470b24700d
7191662: JCE providers should be located via ServiceLoader
valeriep
parents:
28403
diff
changeset
|
798 |
T[] r = Arrays.copyOf(a, a.length + b.length); |
2 | 799 |
System.arraycopy(b, 0, r, a.length, b.length); |
800 |
return r; |
|
801 |
} |
|
802 |
||
28403 | 803 |
/** |
804 |
* Returns supported algorithms of specified type. |
|
805 |
*/ |
|
806 |
static List<String> getSupportedAlgorithms(String type, String alg, |
|
807 |
Provider p) { |
|
808 |
// prepare a list of supported algorithms |
|
809 |
List<String> algorithms = new ArrayList<>(); |
|
810 |
Set<Provider.Service> services = p.getServices(); |
|
811 |
for (Provider.Service service : services) { |
|
812 |
if (service.getType().equals(type) |
|
813 |
&& service.getAlgorithm().startsWith(alg)) { |
|
814 |
algorithms.add(service.getAlgorithm()); |
|
815 |
} |
|
816 |
} |
|
817 |
return algorithms; |
|
818 |
} |
|
819 |
||
32138
23830562d3d1
8133318: Exclude intermittent failing PKCS11 tests on Solaris SPARC 11.1 and earlier
vinnie
parents:
31270
diff
changeset
|
820 |
/** |
23830562d3d1
8133318: Exclude intermittent failing PKCS11 tests on Solaris SPARC 11.1 and earlier
vinnie
parents:
31270
diff
changeset
|
821 |
* Get the identifier for the operating system distribution |
23830562d3d1
8133318: Exclude intermittent failing PKCS11 tests on Solaris SPARC 11.1 and earlier
vinnie
parents:
31270
diff
changeset
|
822 |
*/ |
35379
1e8e336ef66b
8144539: Update PKCS11 tests to run with security manager
asmotrak
parents:
35248
diff
changeset
|
823 |
static String getDistro() { |
42366
b1483ec50db1
8170523: Some PKCS11 test cases are ignored with security manager
mli
parents:
41556
diff
changeset
|
824 |
return distro; |
b1483ec50db1
8170523: Some PKCS11 test cases are ignored with security manager
mli
parents:
41556
diff
changeset
|
825 |
} |
b1483ec50db1
8170523: Some PKCS11 test cases are ignored with security manager
mli
parents:
41556
diff
changeset
|
826 |
|
b1483ec50db1
8170523: Some PKCS11 test cases are ignored with security manager
mli
parents:
41556
diff
changeset
|
827 |
private static String distro() { |
48248
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
828 |
if (props.getProperty("os.name").equals("SunOS")) { |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
829 |
try (BufferedReader in = |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
830 |
new BufferedReader(new InputStreamReader( |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
831 |
Runtime.getRuntime().exec("uname -v").getInputStream()))) { |
32138
23830562d3d1
8133318: Exclude intermittent failing PKCS11 tests on Solaris SPARC 11.1 and earlier
vinnie
parents:
31270
diff
changeset
|
832 |
|
48248
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
833 |
return in.readLine(); |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
834 |
} catch (Exception e) { |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
835 |
throw new RuntimeException("Failed to determine distro.", e); |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
836 |
} |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
837 |
} else { |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
838 |
// Not used outside Solaris |
55b9b1e184c6
8165996: PKCS11 using NSS throws an error regarding secmod.db when NSS uses sqlite
weijun
parents:
47216
diff
changeset
|
839 |
return null; |
32138
23830562d3d1
8133318: Exclude intermittent failing PKCS11 tests on Solaris SPARC 11.1 and earlier
vinnie
parents:
31270
diff
changeset
|
840 |
} |
23830562d3d1
8133318: Exclude intermittent failing PKCS11 tests on Solaris SPARC 11.1 and earlier
vinnie
parents:
31270
diff
changeset
|
841 |
} |
32635
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
842 |
|
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
843 |
static byte[] generateData(int length) { |
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
844 |
byte data[] = new byte[length]; |
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
845 |
for (int i=0; i<data.length; i++) { |
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
846 |
data[i] = (byte) (i % 256); |
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
847 |
} |
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
848 |
return data; |
d7e4ba3c2e0d
8048622: Enhance tests for PKCS11 keystores with NSS
asmotrak
parents:
32138
diff
changeset
|
849 |
} |
51460
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
850 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
851 |
private static String fetchNssLib(String osId) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
852 |
switch (osId) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
853 |
case "Windows-x86-32": |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
854 |
return fetchNssLib(WINDOWS_X86.class); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
855 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
856 |
case "Windows-amd64-64": |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
857 |
return fetchNssLib(WINDOWS_X64.class); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
858 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
859 |
case "MacOSX-x86_64-64": |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
860 |
return fetchNssLib(MACOSX_X64.class); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
861 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
862 |
default: |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
863 |
return null; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
864 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
865 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
866 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
867 |
private static String fetchNssLib(Class<?> clazz) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
868 |
String path = null; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
869 |
try { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
870 |
path = ArtifactResolver.resolve(clazz).entrySet().stream() |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
871 |
.findAny().get().getValue() + File.separator + "nsslib" |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
872 |
+ File.separator; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
873 |
} catch (ArtifactResolverException e) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
874 |
Throwable cause = e.getCause(); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
875 |
if (cause == null) { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
876 |
System.out.println("Cannot resolve artifact, " |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
877 |
+ "please check if JIB jar is present in classpath."); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
878 |
} else { |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
879 |
throw new RuntimeException("Fetch artifact failed: " + clazz |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
880 |
+ "\nPlease make sure the artifact is available."); |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
881 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
882 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
883 |
return path; |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
884 |
} |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
885 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
886 |
@Artifact( |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
887 |
organization = "jpg.tests.jdk.nsslib", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
888 |
name = "nsslib-windows_x64", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
889 |
revision = "3.35", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
890 |
extension = "zip") |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
891 |
private static class WINDOWS_X64 { } |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
892 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
893 |
@Artifact( |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
894 |
organization = "jpg.tests.jdk.nsslib", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
895 |
name = "nsslib-windows_x86", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
896 |
revision = "3.35", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
897 |
extension = "zip") |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
898 |
private static class WINDOWS_X86 { } |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
899 |
|
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
900 |
@Artifact( |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
901 |
organization = "jpg.tests.jdk.nsslib", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
902 |
name = "nsslib-macosx_x64", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
903 |
revision = "3.35", |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
904 |
extension = "zip") |
97e361fe3433
8164639: Configure PKCS11 tests to use user-supplied NSS libraries
jjiang
parents:
51361
diff
changeset
|
905 |
private static class MACOSX_X64 { } |
2 | 906 |
} |