author | valeriep |
Wed, 22 May 2019 21:38:16 +0000 | |
changeset 54996 | 3081932e7efd |
parent 50817 | fa1e04811ff6 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
54996
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
42365
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
26 |
/* |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
27 |
* README README README README README README README README README |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
28 |
* |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
29 |
* This file is the template for generating the JceSecurity.java source |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
30 |
* file. |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
31 |
* |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
32 |
* In the current jdk builds, this file is first preprocessed to replace |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
33 |
* @@JCE_DEFAULT_POLICY@ [sic] with "limited" or "unlimited" which is |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
34 |
* determined by the $(UNLIMTED_CRYPTO) make variable. This variable is |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
35 |
* set by top-level configure script, using either |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
36 |
* --disable-unlimited-crypto or --enable-unlimited-crypto [default]. |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
37 |
* |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
38 |
* Since this file is a generated source, incremental changes to |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
39 |
* this file require regenerating the source. Compilation options: |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
40 |
* |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
41 |
* (fewer dependencies/"faster" ones first) |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
42 |
* |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
43 |
* 1. make JDK_FILTER=javax/crypto java.base-gensrc-only java.base-java-only |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
44 |
* 2. make java.base-gensrc-only java.base-java-only |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
45 |
* 3. make java.base-gensrc-only java.base-only |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
46 |
* 4. make java.base-only |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
47 |
* 5. make |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
48 |
*/ |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
49 |
|
2 | 50 |
package javax.crypto; |
51 |
||
52 |
import java.util.*; |
|
54996
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
53 |
import java.util.concurrent.ConcurrentHashMap; |
2 | 54 |
import java.io.*; |
55 |
import java.net.URL; |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
56 |
import java.nio.file.*; |
2 | 57 |
import java.security.*; |
58 |
||
59 |
import java.security.Provider.Service; |
|
60 |
||
50817
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47216
diff
changeset
|
61 |
import jdk.internal.util.StaticProperty; |
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47216
diff
changeset
|
62 |
|
2 | 63 |
import sun.security.jca.*; |
64 |
import sun.security.jca.GetInstance.Instance; |
|
42365
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
65 |
import sun.security.util.Debug; |
2 | 66 |
|
67 |
/** |
|
68 |
* This class instantiates implementations of JCE engine classes from |
|
69 |
* providers registered with the java.security.Security object. |
|
70 |
* |
|
71 |
* @author Jan Luehe |
|
72 |
* @author Sharon Liu |
|
73 |
* @since 1.4 |
|
74 |
*/ |
|
75 |
||
76 |
final class JceSecurity { |
|
50817
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47216
diff
changeset
|
77 |
|
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47216
diff
changeset
|
78 |
|
42365
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
79 |
private static final Debug debug = Debug.getInstance("jca"); |
2 | 80 |
|
81 |
static final SecureRandom RANDOM = new SecureRandom(); |
|
82 |
||
83 |
// The defaultPolicy and exemptPolicy will be set up |
|
84 |
// in the static initializer. |
|
85 |
private static CryptoPermissions defaultPolicy = null; |
|
86 |
private static CryptoPermissions exemptPolicy = null; |
|
87 |
||
54996
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
88 |
// Map of the providers we already have verified. |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
89 |
// If verified ok, value == PROVIDER_VERIFIED, otherwise |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
90 |
// the cause of verification failure is stored as value. |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
91 |
private static final Map<IdentityWrapper, Object> |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
92 |
verificationResults = new ConcurrentHashMap<>(); |
2 | 93 |
|
94 |
// Map<Provider,?> of the providers currently being verified |
|
32649
2ee9017c7597
8136583: Core libraries should use blessed modifier order
martin
parents:
30033
diff
changeset
|
95 |
private static final Map<Provider, Object> verifyingProviders = |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
96 |
new IdentityHashMap<>(); |
2 | 97 |
|
36119 | 98 |
private static final boolean isRestricted; |
2 | 99 |
|
100 |
/* |
|
101 |
* Don't let anyone instantiate this. |
|
102 |
*/ |
|
103 |
private JceSecurity() { |
|
104 |
} |
|
105 |
||
106 |
static { |
|
107 |
try { |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
108 |
AccessController.doPrivileged( |
30033
b9c86c17164a
8078468: Update security libraries to use diamond with anonymous classes
darcy
parents:
26861
diff
changeset
|
109 |
new PrivilegedExceptionAction<> () { |
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
110 |
@Override |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
111 |
public Void run() throws Exception { |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
112 |
setupJurisdictionPolicies(); |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
113 |
return null; |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
114 |
} |
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
115 |
} |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
116 |
); |
2 | 117 |
|
118 |
isRestricted = defaultPolicy.implies( |
|
119 |
CryptoAllPermission.INSTANCE) ? false : true; |
|
120 |
} catch (Exception e) { |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
121 |
throw new SecurityException( |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
122 |
"Can not initialize cryptographic mechanism", e); |
2 | 123 |
} |
124 |
} |
|
125 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
126 |
static Instance getInstance(String type, Class<?> clazz, String algorithm, |
2 | 127 |
String provider) throws NoSuchAlgorithmException, |
128 |
NoSuchProviderException { |
|
129 |
Service s = GetInstance.getService(type, algorithm, provider); |
|
130 |
Exception ve = getVerificationResult(s.getProvider()); |
|
131 |
if (ve != null) { |
|
132 |
String msg = "JCE cannot authenticate the provider " + provider; |
|
133 |
throw (NoSuchProviderException) |
|
134 |
new NoSuchProviderException(msg).initCause(ve); |
|
135 |
} |
|
136 |
return GetInstance.getInstance(s, clazz); |
|
137 |
} |
|
138 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
139 |
static Instance getInstance(String type, Class<?> clazz, String algorithm, |
2 | 140 |
Provider provider) throws NoSuchAlgorithmException { |
141 |
Service s = GetInstance.getService(type, algorithm, provider); |
|
142 |
Exception ve = JceSecurity.getVerificationResult(provider); |
|
143 |
if (ve != null) { |
|
144 |
String msg = "JCE cannot authenticate the provider " |
|
145 |
+ provider.getName(); |
|
146 |
throw new SecurityException(msg, ve); |
|
147 |
} |
|
148 |
return GetInstance.getInstance(s, clazz); |
|
149 |
} |
|
150 |
||
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
151 |
static Instance getInstance(String type, Class<?> clazz, String algorithm) |
2 | 152 |
throws NoSuchAlgorithmException { |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
153 |
List<Service> services = GetInstance.getServices(type, algorithm); |
2 | 154 |
NoSuchAlgorithmException failure = null; |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
155 |
for (Service s : services) { |
2 | 156 |
if (canUseProvider(s.getProvider()) == false) { |
157 |
// allow only signed providers |
|
158 |
continue; |
|
159 |
} |
|
160 |
try { |
|
161 |
Instance instance = GetInstance.getInstance(s, clazz); |
|
162 |
return instance; |
|
163 |
} catch (NoSuchAlgorithmException e) { |
|
164 |
failure = e; |
|
165 |
} |
|
166 |
} |
|
167 |
throw new NoSuchAlgorithmException("Algorithm " + algorithm |
|
168 |
+ " not available", failure); |
|
169 |
} |
|
170 |
||
171 |
/** |
|
172 |
* Verify if the JAR at URL codeBase is a signed exempt application |
|
173 |
* JAR file and returns the permissions bundled with the JAR. |
|
174 |
* |
|
175 |
* @throws Exception on error |
|
176 |
*/ |
|
177 |
static CryptoPermissions verifyExemptJar(URL codeBase) throws Exception { |
|
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
178 |
ProviderVerifier pv = new ProviderVerifier(codeBase, true); |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
179 |
pv.verify(); |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
180 |
return pv.getPermissions(); |
2 | 181 |
} |
182 |
||
183 |
/** |
|
184 |
* Verify if the JAR at URL codeBase is a signed provider JAR file. |
|
185 |
* |
|
186 |
* @throws Exception on error |
|
187 |
*/ |
|
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
188 |
static void verifyProvider(URL codeBase, Provider p) throws Exception { |
2 | 189 |
// Verify the provider JAR file and all |
190 |
// supporting JAR files if there are any. |
|
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
191 |
ProviderVerifier pv = new ProviderVerifier(codeBase, p, false); |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
192 |
pv.verify(); |
2 | 193 |
} |
194 |
||
32649
2ee9017c7597
8136583: Core libraries should use blessed modifier order
martin
parents:
30033
diff
changeset
|
195 |
private static final Object PROVIDER_VERIFIED = Boolean.TRUE; |
2 | 196 |
|
197 |
/* |
|
198 |
* Verify that the provider JAR files are signed properly, which |
|
199 |
* means the signer's certificate can be traced back to a |
|
200 |
* JCE trusted CA. |
|
201 |
* Return null if ok, failure Exception if verification failed. |
|
202 |
*/ |
|
54996
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
203 |
static Exception getVerificationResult(Provider p) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
204 |
IdentityWrapper pKey = new IdentityWrapper(p); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
205 |
Object o = verificationResults.get(pKey); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
206 |
// no mapping found |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
207 |
if (o == null) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
208 |
synchronized (JceSecurity.class) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
209 |
// check cache again in case the result is now available |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
210 |
o = verificationResults.get(pKey); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
211 |
if (o == null) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
212 |
if (verifyingProviders.get(p) != null) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
213 |
// recursion; return failure now |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
214 |
return new NoSuchProviderException |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
215 |
("Recursion during verification"); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
216 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
217 |
try { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
218 |
verifyingProviders.put(p, Boolean.FALSE); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
219 |
URL providerURL = getCodeBase(p.getClass()); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
220 |
verifyProvider(providerURL, p); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
221 |
o = PROVIDER_VERIFIED; |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
222 |
} catch (Exception e) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
223 |
o = e; |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
224 |
} finally { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
225 |
verifyingProviders.remove(p); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
226 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
227 |
verificationResults.put(pKey, o); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
228 |
if (debug != null) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
229 |
debug.println("Provider " + p.getName() + |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
230 |
" verification result: " + o); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
231 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
232 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
233 |
} |
2 | 234 |
} |
54996
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
235 |
return (o == PROVIDER_VERIFIED? null : (Exception) o); |
2 | 236 |
} |
237 |
||
238 |
// return whether this provider is properly signed and can be used by JCE |
|
239 |
static boolean canUseProvider(Provider p) { |
|
240 |
return getVerificationResult(p) == null; |
|
241 |
} |
|
242 |
||
243 |
// dummy object to represent null |
|
244 |
private static final URL NULL_URL; |
|
245 |
||
246 |
static { |
|
247 |
try { |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
248 |
NULL_URL = new URL("http://null.oracle.com/"); |
2 | 249 |
} catch (Exception e) { |
250 |
throw new RuntimeException(e); |
|
251 |
} |
|
252 |
} |
|
253 |
||
254 |
// reference to a Map we use as a cache for codebases |
|
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
255 |
private static final Map<Class<?>, URL> codeBaseCacheRef = |
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
256 |
new WeakHashMap<>(); |
2 | 257 |
|
258 |
/* |
|
24501
767c30e88a61
8028627: Unsynchronized code path from javax.crypto.Cipher to the WeakHashMap used by JceSecurity to store codebase mappings
robm
parents:
10336
diff
changeset
|
259 |
* Returns the CodeBase for the given class. |
2 | 260 |
*/ |
10336
0bb1999251f8
7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents:
5506
diff
changeset
|
261 |
static URL getCodeBase(final Class<?> clazz) { |
24501
767c30e88a61
8028627: Unsynchronized code path from javax.crypto.Cipher to the WeakHashMap used by JceSecurity to store codebase mappings
robm
parents:
10336
diff
changeset
|
262 |
synchronized (codeBaseCacheRef) { |
767c30e88a61
8028627: Unsynchronized code path from javax.crypto.Cipher to the WeakHashMap used by JceSecurity to store codebase mappings
robm
parents:
10336
diff
changeset
|
263 |
URL url = codeBaseCacheRef.get(clazz); |
767c30e88a61
8028627: Unsynchronized code path from javax.crypto.Cipher to the WeakHashMap used by JceSecurity to store codebase mappings
robm
parents:
10336
diff
changeset
|
264 |
if (url == null) { |
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
265 |
url = AccessController.doPrivileged( |
30033
b9c86c17164a
8078468: Update security libraries to use diamond with anonymous classes
darcy
parents:
26861
diff
changeset
|
266 |
new PrivilegedAction<>() { |
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
267 |
@Override |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
268 |
public URL run() { |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
269 |
ProtectionDomain pd = clazz.getProtectionDomain(); |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
270 |
if (pd != null) { |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
271 |
CodeSource cs = pd.getCodeSource(); |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
272 |
if (cs != null) { |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
273 |
return cs.getLocation(); |
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
274 |
} |
24501
767c30e88a61
8028627: Unsynchronized code path from javax.crypto.Cipher to the WeakHashMap used by JceSecurity to store codebase mappings
robm
parents:
10336
diff
changeset
|
275 |
} |
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
276 |
return NULL_URL; |
2 | 277 |
} |
26861
47dde7f5cf36
8058845: Update JCE environment for build improvements
wetmore
parents:
25859
diff
changeset
|
278 |
}); |
24501
767c30e88a61
8028627: Unsynchronized code path from javax.crypto.Cipher to the WeakHashMap used by JceSecurity to store codebase mappings
robm
parents:
10336
diff
changeset
|
279 |
codeBaseCacheRef.put(clazz, url); |
767c30e88a61
8028627: Unsynchronized code path from javax.crypto.Cipher to the WeakHashMap used by JceSecurity to store codebase mappings
robm
parents:
10336
diff
changeset
|
280 |
} |
767c30e88a61
8028627: Unsynchronized code path from javax.crypto.Cipher to the WeakHashMap used by JceSecurity to store codebase mappings
robm
parents:
10336
diff
changeset
|
281 |
return (url == NULL_URL) ? null : url; |
2 | 282 |
} |
283 |
} |
|
284 |
||
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
285 |
// This is called from within an doPrivileged block. |
2 | 286 |
private static void setupJurisdictionPolicies() throws Exception { |
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
287 |
|
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
288 |
// Sanity check the crypto.policy Security property. Single |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
289 |
// directory entry, no pseudo-directories (".", "..", leading/trailing |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
290 |
// path separators). normalize()/getParent() will help later. |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
291 |
String cryptoPolicyProperty = Security.getProperty("crypto.policy"); |
42365
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
292 |
|
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
293 |
/* |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
294 |
* In case no property is present, rather than fail catastrophically, |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
295 |
* we at least try for a "sane" value, which is what we were |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
296 |
* built with. We first preprocess this file to plug in that |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
297 |
* value, then compile the result gensrc. |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
298 |
* |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
299 |
* Log the warning first. |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
300 |
*/ |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
301 |
if (cryptoPolicyProperty == null) { |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
302 |
cryptoPolicyProperty = "@@JCE_DEFAULT_POLICY@@"; |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
303 |
if (debug != null) { |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
304 |
debug.println( |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
305 |
"Security Property 'crypto.policy' not found: " |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
306 |
+ "using '" + cryptoPolicyProperty + "' as fallback"); |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
307 |
} |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
308 |
} |
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
309 |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
310 |
Path cpPath = Paths.get(cryptoPolicyProperty); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
311 |
|
42365
5e640c2994d6
8170157: Enable unlimited cryptographic policy by default in OracleJDK
wetmore
parents:
40565
diff
changeset
|
312 |
if ((cpPath.getNameCount() != 1) || |
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
313 |
(cpPath.compareTo(cpPath.getFileName()) != 0)) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
314 |
throw new SecurityException( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
315 |
"Invalid policy directory name format: " + |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
316 |
cryptoPolicyProperty); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
317 |
} |
2 | 318 |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
319 |
// Prepend java.home to get the full path. normalize() in |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
320 |
// case an extra "." or ".." snuck in somehow. |
50817
fa1e04811ff6
8066709: Make some JDK system properties read only
rriggs
parents:
47216
diff
changeset
|
321 |
String javaHomeProperty = StaticProperty.javaHome(); |
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
322 |
Path javaHomePolicyPath = Paths.get(javaHomeProperty, "conf", |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
323 |
"security", "policy").normalize(); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
324 |
Path cryptoPolicyPath = Paths.get(javaHomeProperty, "conf", "security", |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
325 |
"policy", cryptoPolicyProperty).normalize(); |
2 | 326 |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
327 |
if (cryptoPolicyPath.getParent().compareTo(javaHomePolicyPath) != 0) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
328 |
throw new SecurityException( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
329 |
"Invalid cryptographic jurisdiction policy directory path: " + |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
330 |
cryptoPolicyProperty); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
331 |
} |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
332 |
|
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
333 |
if (!Files.isDirectory(cryptoPolicyPath) |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
334 |
|| !Files.isReadable(cryptoPolicyPath)) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
335 |
throw new SecurityException( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
336 |
"Can't read cryptographic policy directory: " + |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
337 |
cryptoPolicyProperty); |
2 | 338 |
} |
339 |
||
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
340 |
try (DirectoryStream<Path> stream = Files.newDirectoryStream( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
341 |
cryptoPolicyPath, "{default,exempt}_*.policy")) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
342 |
for (Path entry : stream) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
343 |
try (InputStream is = new BufferedInputStream( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
344 |
Files.newInputStream(entry))) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
345 |
String filename = entry.getFileName().toString(); |
2 | 346 |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
347 |
CryptoPermissions tmpPerms = new CryptoPermissions(); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
348 |
tmpPerms.load(is); |
2 | 349 |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
350 |
if (filename.startsWith("default_")) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
351 |
// Did we find a default perms? |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
352 |
defaultPolicy = ((defaultPolicy == null) ? tmpPerms : |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
353 |
defaultPolicy.getMinimum(tmpPerms)); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
354 |
} else if (filename.startsWith("exempt_")) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
355 |
// Did we find a exempt perms? |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
356 |
exemptPolicy = ((exemptPolicy == null) ? tmpPerms : |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
357 |
exemptPolicy.getMinimum(tmpPerms)); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
358 |
} else { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
359 |
// This should never happen. newDirectoryStream |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
360 |
// should only throw return "{default,exempt}_*.policy" |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
361 |
throw new SecurityException( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
362 |
"Unexpected jurisdiction policy files in : " + |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
363 |
cryptoPolicyProperty); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
364 |
} |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
365 |
} catch (Exception e) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
366 |
throw new SecurityException( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
367 |
"Couldn't parse jurisdiction policy files in: " + |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
368 |
cryptoPolicyProperty); |
2 | 369 |
} |
370 |
} |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
371 |
} catch (DirectoryIteratorException ex) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
372 |
// I/O error encountered during the iteration, |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
373 |
// the cause is an IOException |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
374 |
throw new SecurityException( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
375 |
"Couldn't iterate through the jurisdiction policy files: " + |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
376 |
cryptoPolicyProperty); |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
377 |
} |
2 | 378 |
|
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
379 |
// Must have a default policy |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
380 |
if ((defaultPolicy == null) || defaultPolicy.isEmpty()) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
381 |
throw new SecurityException( |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
382 |
"Missing mandatory jurisdiction policy files: " + |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
383 |
cryptoPolicyProperty); |
2 | 384 |
} |
40565
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
385 |
|
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
386 |
// If there was an empty exempt policy file, ignore it. |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
387 |
if ((exemptPolicy != null) && exemptPolicy.isEmpty()) { |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
388 |
exemptPolicy = null; |
3ac0ba151e70
8061842: Package jurisdiction policy files as something other than JAR
wetmore
parents:
36511
diff
changeset
|
389 |
} |
2 | 390 |
} |
391 |
||
392 |
static CryptoPermissions getDefaultPolicy() { |
|
393 |
return defaultPolicy; |
|
394 |
} |
|
395 |
||
396 |
static CryptoPermissions getExemptPolicy() { |
|
397 |
return exemptPolicy; |
|
398 |
} |
|
399 |
||
400 |
static boolean isRestricted() { |
|
401 |
return isRestricted; |
|
402 |
} |
|
54996
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
403 |
|
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
404 |
private static final class IdentityWrapper { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
405 |
|
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
406 |
final Provider obj; |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
407 |
|
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
408 |
IdentityWrapper(Provider obj) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
409 |
this.obj = obj; |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
410 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
411 |
|
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
412 |
@Override |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
413 |
public boolean equals(Object o) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
414 |
if (this == o) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
415 |
return true; |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
416 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
417 |
if (!(o instanceof IdentityWrapper)) { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
418 |
return false; |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
419 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
420 |
return this.obj == ((IdentityWrapper)o).obj; |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
421 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
422 |
|
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
423 |
@Override |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
424 |
public int hashCode() { |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
425 |
return System.identityHashCode(obj); |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
426 |
} |
3081932e7efd
7107615: scalability bloker in javax.crypto.JceSecurity
valeriep
parents:
50817
diff
changeset
|
427 |
} |
2 | 428 |
} |