Produced by Araxis Merge on 9/25/2018 2:13:23 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\internal\spec | TlsKeyMaterialParameterSpec.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\internal\spec | TlsKeyMaterialParameterSpec.java | Wed Sep 12 17:51:32 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 5 | 498 |
Changed | 4 | 8 |
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 5, 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 su n.security .internal. spec; | |
27 | ||
28 | import jav a.security .spec.Algo rithmParam eterSpec; | |
29 | ||
30 | import jav ax.crypto. SecretKey; | |
31 | ||
32 | /** | |
33 | * Paramet ers for SS L/TLS key material g eneration. | |
34 | * This cl ass is use d to initi alize KeyG enerator o f the type | |
35 | * "TlsKey Material". The keys returned b y such Key Generators will be | |
36 | * instanc es of {@li nk TlsKeyM aterialSpe c}. | |
37 | * | |
38 | * <p>Inst ances of t his class are immuta ble. | |
39 | * | |
40 | * @since 1.6 | |
41 | * @author Andreas Sterbenz | |
42 | * @deprec ated Sun J DK interna l use only --- WILL BE REMOVED in a futu re | |
43 | * release . | |
44 | */ | |
45 | @Deprecate d | |
46 | public cla ss TlsKeyM aterialPar ameterSpec implement s Algorith mParameter Spec { | |
47 | ||
48 | privat e final Se cretKey ma sterSecret ; | |
49 | privat e final in t majorVer sion, mino rVersion; | |
50 | privat e final by te[] clien tRandom, s erverRando m; | |
51 | privat e final St ring ciphe rAlgorithm ; | |
52 | privat e final in t cipherKe yLength, i vLength, m acKeyLengt h; | |
53 | privat e final in t expanded CipherKeyL ength; // == 0 for d omestic ci phersuites | |
54 | privat e final St ring prfHa shAlg; | |
55 | privat e final in t prfHashL ength; | |
56 | privat e final in t prfBlock Size; | |
57 | ||
58 | /** | |
59 | * Con structs a new TlsKey MaterialPa rameterSpe c. | |
60 | * | |
61 | * @param m asterSecre t the mast er PW | |
62 | * @pa ram majorV ersion the major num ber of the protocol version | |
63 | * @pa ram minorV ersion the minor num ber of the protocol version | |
64 | * @pa ram client Random the client's random val ue | |
65 | * @pa ram server Random the server's random val ue | |
66 | * @pa ram cipher Algorithm the algori thm name o f the ciph er keys to | |
67 | * be generat ed | |
68 | * @pa ram cipher KeyLength if 0, no c ipher keys will be g enerated; | |
69 | * otherwise, the lengt h in bytes of cipher keys to b e | |
70 | * generated for domest ic cipher suites; fo r cipher s uites defi ned as | |
71 | * exportable , the numb er of key material b ytes to be generated ; | |
72 | * @pa ram expand edCipherKe yLength 0 for domest ic cipher suites; fo r | |
73 | * exportable cipher su ites the l ength in b ytes of th e key to b e | |
74 | * generated. | |
75 | * @pa ram ivLeng th the len gth in byt es of the initializa tion vecto r | |
76 | * to be gene rated, or 0 if no in itializati on vector is require d | |
77 | * @pa ram macKey Length the length in bytes of the MAC ke y to be ge nerated | |
78 | * @pa ram prfHas hAlg the n ame of the TLS PRF h ash algori thm to use . | |
79 | * Used o nly for TL S 1.2+. T LS1.1 and earlier us e a fixed PRF. | |
80 | * @pa ram prfHas hLength th e output l ength of t he TLS PRF hash algo rithm. | |
81 | * Used o nly for TL S 1.2+. | |
82 | * @pa ram prfBlo ckSize the input blo ck size of the TLS P RF hash al gorithm. | |
83 | * Used o nly for TL S 1.2+. | |
84 | * | |
85 | * @th rows NullP ointerExce ption if m asterSecre t, clientR andom, | |
86 | * s erverRando m, or ciph erAlgorith m are null | |
87 | * @th rows Illeg alArgument Exception if the alg orithm of masterSecr et is | |
88 | * n ot TlsMast erSecret, or if majo rVersion o r minorVer sion are | |
89 | * n egative or larger th an 255; or if cipher KeyLength, expandedK eyLength, | |
90 | * i vLength, o r macKeyLe ngth are n egative | |
91 | */ | |
92 | public TlsKeyMat erialParam eterSpec(S ecretKey m asterSecre t, | |
93 | int majo rVersion, int minorV ersion, by te[] clien tRandom, | |
94 | byte[] s erverRando m, String cipherAlgo rithm, int cipherKey Length, | |
95 | int expa ndedCipher KeyLength, int ivLen gth, int m acKeyLengt h, | |
96 | String p rfHashAlg, int prfHa shLength, int prfBlo ckSize) { | |
97 | if (masterSe cret.getAl gorithm(). equals("Tl sMasterSec ret") == f alse) { | |
98 | throw new IllegalArg umentExcep tion("Not a TLS mast er PW "); | |
99 | } | |
100 | if (cipherAl gorithm == null) { | |
101 | throw ne w NullPoin terExcepti on(); | |
102 | } | |
103 | th is.masterS ecret = ma sterSecret ; | |
104 | th is.majorVe rsion = | |
105 | TlsMaste rSecretPar ameterSpec .checkVers ion(majorV ersion); | |
106 | th is.minorVe rsion = | |
107 | TlsMaste rSecretPar ameterSpec .checkVers ion(minorV ersion); | |
108 | th is.clientR andom = cl ientRandom .clone(); | |
109 | th is.serverR andom = se rverRandom .clone(); | |
110 | th is.cipherA lgorithm = cipherAlg orithm; | |
111 | th is.cipherK eyLength = checkSign (cipherKey Length); | |
112 | th is.expande dCipherKey Length = c heckSign(e xpandedCip herKeyLeng th); | |
113 | th is.ivLengt h = checkS ign(ivLeng th); | |
114 | th is.macKeyL ength = ch eckSign(ma cKeyLength ); | |
115 | th is.prfHash Alg = prfH ashAlg; | |
116 | th is.prfHash Length = p rfHashLeng th; | |
117 | th is.prfBloc kSize = pr fBlockSize ; | |
118 | } | |
119 | ||
120 | privat e static i nt checkSi gn(int k) { | |
121 | if (k < 0) { | |
122 | throw ne w IllegalA rgumentExc eption("Va lue must n ot be nega tive"); | |
123 | } | |
124 | re turn k; | |
125 | } | |
126 | ||
127 | /** | |
128 | * Returns the master PW . | |
129 | * | |
130 | * @return the master PW . | |
131 | */ | |
132 | public SecretKey getMaster Secret() { | |
133 | re turn maste rSecret; | |
134 | } | |
135 | ||
136 | /** | |
137 | * Ret urns the m ajor versi on number. | |
138 | * | |
139 | * @re turn the m ajor versi on number. | |
140 | */ | |
141 | public int getMa jorVersion () { | |
142 | re turn major Version; | |
143 | } | |
144 | ||
145 | /** | |
146 | * Ret urns the m inor versi on number. | |
147 | * | |
148 | * @re turn the m inor versi on number. | |
149 | */ | |
150 | public int getMi norVersion () { | |
151 | re turn minor Version; | |
152 | } | |
153 | ||
154 | /** | |
155 | * Ret urns a cop y of the c lient's ra ndom value . | |
156 | * | |
157 | * @re turn a cop y of the c lient's ra ndom value . | |
158 | */ | |
159 | public byte[] ge tClientRan dom() { | |
160 | re turn clien tRandom.cl one(); | |
161 | } | |
162 | ||
163 | /** | |
164 | * Ret urns a cop y of the s erver's ra ndom value . | |
165 | * | |
166 | * @re turn a cop y of the s erver's ra ndom value . | |
167 | */ | |
168 | public byte[] ge tServerRan dom() { | |
169 | re turn serve rRandom.cl one(); | |
170 | } | |
171 | ||
172 | /** | |
173 | * Ret urns the c ipher algo rithm. | |
174 | * | |
175 | * @re turn the c ipher algo rithm. | |
176 | */ | |
177 | public String ge tCipherAlg orithm() { | |
178 | re turn ciphe rAlgorithm ; | |
179 | } | |
180 | ||
181 | /** | |
182 | * Ret urns the l ength in b ytes of th e encrypti on key to be generat ed. | |
183 | * | |
184 | * @re turn the l ength in b ytes of th e encrypti on key to be generat ed. | |
185 | */ | |
186 | public int getCi pherKeyLen gth() { | |
187 | re turn ciphe rKeyLength ; | |
188 | } | |
189 | ||
190 | /** | |
191 | * Ret urns the l ength in b ytes of th e expanded encryptio n key to b e | |
192 | * gen erated. Re turns zero if the ex panded enc ryption ke y is not | |
193 | * sup posed to b e generate d. | |
194 | * | |
195 | * @re turn the l ength in b ytes of th e expanded encryptio n key to b e | |
196 | * generated . | |
197 | */ | |
198 | public int getEx pandedCiph erKeyLengt h() { | |
199 | // TLS v1.1 disables t he exporta ble weak c ipher suit es. | |
200 | if (majorVer sion >= 0x 03 && mino rVersion > = 0x02) { | |
201 | return 0 ; | |
202 | } | |
203 | re turn expan dedCipherK eyLength; | |
204 | } | |
205 | ||
206 | /** | |
207 | * Ret urns the l ength in b ytes of th e initiali zation vec tor to be | |
208 | * gen erated. Re turns zero if the in itializati on vector is not | |
209 | * sup posed to b e generate d. | |
210 | * | |
211 | * @re turn the l ength in b ytes of th e initiali zation vec tor to be | |
212 | * generated . | |
213 | */ | |
214 | public int getIv Length() { | |
215 | re turn ivLen gth; | |
216 | } | |
217 | ||
218 | /** | |
219 | * Ret urns the l ength in b ytes of th e MAC key to be gene rated. | |
220 | * | |
221 | * @re turn the l ength in b ytes of th e MAC key to be gene rated. | |
222 | */ | |
223 | public int getMa cKeyLength () { | |
224 | re turn macKe yLength; | |
225 | } | |
226 | ||
227 | /** | |
228 | * Obt ains the P RF hash al gorithm to use in th e PRF calc ulation. | |
229 | * | |
230 | * @re turn the h ash algori thm. | |
231 | */ | |
232 | public String ge tPRFHashAl g() { | |
233 | re turn prfHa shAlg; | |
234 | } | |
235 | ||
236 | /** | |
237 | * Obt ains the l ength of t he PRF has h algorith m. | |
238 | * | |
239 | * @re turn the h ash algori thm length . | |
240 | */ | |
241 | public int getPR FHashLengt h() { | |
242 | re turn prfHa shLength; | |
243 | } | |
244 | ||
245 | /** | |
246 | * Obt ains the b lock size of the PRF hash algo rithm. | |
247 | * | |
248 | * @re turn the h ash algori thm block size | |
249 | */ | |
250 | public int getPR FBlockSize () { | |
251 | re turn prfBl ockSize; | |
252 | } | |
253 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.