Produced by Araxis Merge on 9/25/2018 2:13:24 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
# | Location | File | Last Modified |
---|---|---|---|
1 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\security\pkcs11 | KeyCache.java | Mon Jan 22 14:46:54 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\sun\security\pkcs11 | KeyCache.java | Wed Sep 12 17:53:06 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 2 | 204 |
Changed | 1 | 2 |
Inserted | 0 | 0 |
Removed | 0 | 0 |
Whitespace | |
---|---|
Character case | Differences in character case are significant |
Line endings | Differences in line endings (CR and LF characters) are ignored |
CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
1 | /* | |
2 | * Copyrig ht (c) 200 3, 2011, O racle and/ or its aff iliates. A ll rights reserved. | |
3 | * DO NOT ALTER OR R EMOVE COPY RIGHT NOTI CES OR THI S FILE HEA DER. | |
4 | * | |
5 | * This co de is free software; you can r edistribut e it and/o r modify i t | |
6 | * under t he terms o f the GNU General Pu blic Licen se version 2 only, a s | |
7 | * publish ed by the Free Softw are Founda tion. Ora cle design ates this | |
8 | * particu lar file a s subject to the "Cl asspath" e xception a s provided | |
9 | * by Orac le in the LICENSE fi le that ac companied this code. | |
10 | * | |
11 | * This co de is dist ributed in the hope that it wi ll be usef ul, but WI THOUT | |
12 | * ANY WAR RANTY; wit hout even the implie d warranty of MERCHA NTABILITY or | |
13 | * FITNESS FOR A PAR TICULAR PU RPOSE. Se e the GNU General Pu blic Licen se | |
14 | * version 2 for mor e details (a copy is included in the LIC ENSE file that | |
15 | * accompa nied this code). | |
16 | * | |
17 | * You sho uld have r eceived a copy of th e GNU Gene ral Public License v ersion | |
18 | * 2 along with this work; if not, write to the Fr ee Softwar e Foundati on, | |
19 | * Inc., 5 1 Franklin St, Fifth Floor, Bo ston, MA 0 2110-1301 USA. | |
20 | * | |
21 | * Please contact Or acle, 500 Oracle Par kway, Redw ood Shores , CA 94065 USA | |
22 | * or visi t www.orac le.com if you need a dditional informatio n or have any | |
23 | * questio ns. | |
24 | */ | |
25 | ||
26 | package su n.security .pkcs11; | |
27 | ||
28 | import jav a.util.*; | |
29 | import jav a.lang.ref .*; | |
30 | ||
31 | import jav a.security .Key; | |
32 | ||
33 | import sun .security. util.Cache ; | |
34 | ||
35 | /** | |
36 | * Key to P11Key tra nslation c ache. The PKCS#11 to ken can on ly perform | |
37 | * operati ons on key s stored o n the toke n (permane ntly or te mporarily) . That | |
38 | * means t hat in ord er to allo w the PKCS #11 provid er to use keys from other | |
39 | * provide rs, we nee d to trans parently c onvert the m to P11Ke ys. The en gines | |
40 | * do that using (Se cret)KeyFa ctories, w hich in tu rn use thi s class as a | |
41 | * cache. | |
42 | * | |
43 | * There a re two Key Cache inst ances per provider, one for PW keys and | |
44 | * one for public an d private keys. | |
45 | * | |
46 | * @author Andreas Sterbenz | |
47 | * @since 1.5 | |
48 | */ | |
49 | final clas s KeyCache { | |
50 | ||
51 | privat e final Ca che<Identi tyWrapper, P11Key> s trongCache ; | |
52 | ||
53 | privat e WeakRefe rence<Map< Key,P11Key >> cacheRe ference; | |
54 | ||
55 | KeyCac he() { | |
56 | st rongCache = Cache.ne wHardMemor yCache(16) ; | |
57 | } | |
58 | ||
59 | privat e static f inal class IdentityW rapper { | |
60 | fi nal Object obj; | |
61 | Id entityWrap per(Object obj) { | |
62 | this.obj = obj; | |
63 | } | |
64 | pu blic boole an equals( Object o) { | |
65 | if (this == o) { | |
66 | retu rn true; | |
67 | } | |
68 | if (o in stanceof I dentityWra pper == fa lse) { | |
69 | retu rn false; | |
70 | } | |
71 | Identity Wrapper ot her = (Ide ntityWrapp er)o; | |
72 | return t his.obj == other.obj ; | |
73 | } | |
74 | pu blic int h ashCode() { | |
75 | return S ystem.iden tityHashCo de(obj); | |
76 | } | |
77 | } | |
78 | ||
79 | synchr onized P11 Key get(Ke y key) { | |
80 | P1 1Key p11Ke y = strong Cache.get( new Identi tyWrapper( key)); | |
81 | if (p11Key ! = null) { | |
82 | return p 11Key; | |
83 | } | |
84 | Ma p<Key,P11K ey> map = | |
85 | (cac heReferenc e == null) ? null : cacheRefer ence.get() ; | |
86 | if (map == n ull) { | |
87 | return n ull; | |
88 | } | |
89 | re turn map.g et(key); | |
90 | } | |
91 | ||
92 | synchr onized voi d put(Key key, P11Ke y p11Key) { | |
93 | st rongCache. put(new Id entityWrap per(key), p11Key); | |
94 | Ma p<Key,P11K ey> map = | |
95 | (cac heReferenc e == null) ? null : cacheRefer ence.get() ; | |
96 | if (map == n ull) { | |
97 | map = ne w Identity HashMap<>( ); | |
98 | cacheRef erence = n ew WeakRef erence<>(m ap); | |
99 | } | |
100 | ma p.put(key, p11Key); | |
101 | } | |
102 | ||
103 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.