Produced by Araxis Merge on 9/25/2018 2:13:01 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\com\sun\crypto\provider | DESedeKeyFactory.java | Mon Jan 22 14:46:50 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\com\sun\crypto\provider | DESedeKeyFactory.java | Wed Sep 12 16:22:23 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 3 | 320 |
Changed | 2 | 4 |
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) 199 7, 2013, 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 co m.sun.cryp to.provide r; | |
27 | ||
28 | import jav ax.crypto. SecretKey; | |
29 | import jav ax.crypto. SecretKeyF actorySpi; | |
30 | import jav ax.crypto. spec.DESed eKeySpec; | |
31 | import jav a.security .InvalidKe yException ; | |
32 | import jav a.security .spec.KeyS pec; | |
33 | import jav a.security .spec.Inva lidKeySpec Exception; | |
34 | import jav ax.crypto. spec.Secre tKeySpec; | |
35 | ||
36 | /** | |
37 | * This cl ass implem ents the D ES-EDE key factory o f the Sun provider. | |
38 | * | |
39 | * @author Jan Luehe | |
40 | * | |
41 | */ | |
42 | ||
43 | public fin al class D ESedeKeyFa ctory exte nds Secret KeyFactory Spi { | |
44 | ||
45 | /** | |
46 | * Emp ty constru ctor | |
47 | */ | |
48 | public DESedeKey Factory() { | |
49 | } | |
50 | ||
51 | /** | |
52 | * Gen erates a < code>Secre tKey</code > object f rom the pr ovided key | |
53 | * spe cification (key mate rial). | |
54 | * | |
55 | * @param k eySpec the specifica tion (key material) of the PW key | |
56 | * | |
57 | * @return the PW key | |
58 | * | |
59 | * @ex ception In validKeySp ecExceptio n if the g iven key s pecificati on | |
60 | * is inappropri ate for th is key fac tory to pr oduce a pu blic key. | |
61 | */ | |
62 | protec ted Secret Key engine GenerateSe cret(KeySp ec keySpec ) | |
63 | th rows Inval idKeySpecE xception { | |
64 | ||
65 | tr y { | |
66 | if (keyS pec instan ceof DESed eKeySpec) { | |
67 | retu rn new DES edeKey(((D ESedeKeySp ec)keySpec ).getKey() ); | |
68 | } | |
69 | if (keyS pec instan ceof Secre tKeySpec) { | |
70 | retu rn new DES edeKey(((S ecretKeySp ec)keySpec ).getEncod ed()); | |
71 | ||
72 | } | |
73 | throw ne w InvalidK eySpecExce ption | |
74 | ("In appropriat e key spec ification" ); | |
75 | } catch (Inv alidKeyExc eption e) { | |
76 | throw ne w InvalidK eySpecExce ption(e.ge tMessage() ); | |
77 | } | |
78 | } | |
79 | ||
80 | /** | |
81 | * Ret urns a spe cification (key mate rial) of t he given k ey | |
82 | * in the reques ted format . | |
83 | * | |
84 | * @pa ram key th e key | |
85 | * | |
86 | * @pa ram keySpe c the requ ested form at in whic h the key material s hall be | |
87 | * ret urned | |
88 | * | |
89 | * @re turn the u nderlying key specif ication (k ey materia l) in the | |
90 | * req uested for mat | |
91 | * | |
92 | * @ex ception In validKeySp ecExceptio n if the r equested k ey specifi cation is | |
93 | * ina ppropriate for the g iven key, or the giv en key can not be pro cessed | |
94 | * (e. g., the gi ven key ha s an unrec ognized al gorithm or format). | |
95 | */ | |
96 | protec ted KeySpe c engineGe tKeySpec(S ecretKey k ey, Class< ?> keySpec ) | |
97 | th rows Inval idKeySpecE xception { | |
98 | ||
99 | tr y { | |
100 | if ((key instanceo f SecretKe y) | |
101 | && ( key.getAlg orithm().e qualsIgnor eCase("DES ede")) | |
102 | && ( key.getFor mat().equa lsIgnoreCa se("RAW")) ) { | |
103 | ||
104 | // C heck if re quested ke y spec is amongst th e valid on es | |
105 | if ( DESedeKeyS pec.class. isAssignab leFrom(key Spec)) { | |
106 | return new DESedeKey Spec(key.g etEncoded( )); | |
107 | ||
108 | } el se { | |
109 | throw new InvalidKey SpecExcept ion | |
110 | ("Inap propriate key specif ication"); | |
111 | } | |
112 | ||
113 | } else { | |
114 | thro w new Inva lidKeySpec Exception | |
115 | ("Inapprop riate key format/alg orithm"); | |
116 | } | |
117 | } catch (Inv alidKeyExc eption e) { | |
118 | throw ne w InvalidK eySpecExce ption("Sec ret key ha s wrong si ze"); | |
119 | } | |
120 | } | |
121 | ||
122 | /** | |
123 | * Tra nslates a <code>Secr etKey</cod e> object, whose pro vider may be | |
124 | * unk nown or po tentially untrusted, into a co rrespondin g | |
125 | * <co de>SecretK ey</code> object of this key f actory. | |
126 | * | |
127 | * @pa ram key th e key whos e provider is unknow n or untru sted | |
128 | * | |
129 | * @re turn the t ranslated key | |
130 | * | |
131 | * @ex ception In validKeyEx ception if the given key canno t be proce ssed by | |
132 | * thi s key fact ory. | |
133 | */ | |
134 | protec ted Secret Key engine TranslateK ey(SecretK ey key) | |
135 | th rows Inval idKeyExcep tion { | |
136 | ||
137 | tr y { | |
138 | ||
139 | if ((key != null) | |
140 | && ( key.getAlg orithm().e qualsIgnor eCase("DES ede")) | |
141 | && ( key.getFor mat().equa lsIgnoreCa se("RAW")) ) { | |
142 | // C heck if ke y originat es from th is factory | |
143 | if ( key instan ceof com.s un.crypto. provider.D ESedeKey) { | |
144 | return key ; | |
145 | } | |
146 | // C onvert key to spec | |
147 | DESe deKeySpec desEdeKeyS pec | |
148 | = (DESedeK eySpec)eng ineGetKeyS pec(key, | |
149 | DESede KeySpec.cl ass); | |
150 | // C reate key from spec, and retur n it | |
151 | retu rn engineG enerateSec ret(desEde KeySpec); | |
152 | ||
153 | } else { | |
154 | thro w new Inva lidKeyExce ption | |
155 | ("Inapprop riate key format/alg orithm"); | |
156 | } | |
157 | ||
158 | } catch (Inv alidKeySpe cException e) { | |
159 | throw ne w InvalidK eyExceptio n("Cannot translate key"); | |
160 | } | |
161 | } | |
162 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.