Produced by Araxis Merge on 9/25/2018 2:13:11 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\javax\crypto | KeyAgreementSpi.java | Mon Jan 22 14:46:52 2018 UTC |
2 | build 3.zip\build 3\MHLTH_YS_137_Source\JavaScript\resources\javaJDF-1.8.0\src\javax\crypto | KeyAgreementSpi.java | Wed Sep 12 17:18:34 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 13 | 382 |
Changed | 12 | 26 |
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, 2007, 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 ja vax.crypto ; | |
27 | ||
28 | import jav a.security .*; | |
29 | import jav a.security .spec.*; | |
30 | ||
31 | /** | |
32 | * This cl ass define s the <i>S ervice Pro vider Inte rface</i> (<b>SPI</b >) | |
33 | * for the <code>Key Agreement< /code> cla ss. | |
34 | * All the abstract methods in this clas s must be implemente d by each | |
35 | * cryptog raphic ser vice provi der who wi shes to su pply the i mplementat ion | |
36 | * of a pa rticular k ey agreeme nt algorit hm. | |
37 | * | |
38 | * <p> The keys invo lved in es tablishing a shared PW are create d by one | |
39 | * of the | |
40 | * key gen erators (< code>KeyPa irGenerato r</code> o r | |
41 | * <code>K eyGenerato r</code>), a <code>K eyFactory< /code>, or as a resu lt from | |
42 | * an inte rmediate p hase of th e key agre ement prot ocol | |
43 | * ({@link #engineDo Phase(java .security. Key, boole an) engine DoPhase}). | |
44 | * | |
45 | * <p> For each of t he corresp ondents in the key e xchange, | |
46 | * <code>e ngineDoPha se</code> | |
47 | * needs t o be calle d. For exa mple, if t he key exc hange is w ith one ot her | |
48 | * party, <code>engi neDoPhase< /code> nee ds to be c alled once , with the | |
49 | * <code>l astPhase</ code> flag set to <c ode>true</ code>. | |
50 | * If the key exchan ge is | |
51 | * with tw o other pa rties, <co de>engineD oPhase</co de> needs to be call ed twice, | |
52 | * the fir st time se tting the <code>last Phase</cod e> flag to | |
53 | * <code>f alse</code >, and the second ti me setting it to <co de>true</c ode>. | |
54 | * There m ay be any number of parties in volved in a key exch ange. | |
55 | * | |
56 | * @author Jan Luehe | |
57 | * | |
58 | * @see Ke yGenerator | |
59 | * @see Se cretKey | |
60 | * @since 1.4 | |
61 | */ | |
62 | ||
63 | public abs tract clas s KeyAgree mentSpi { | |
64 | ||
65 | /** | |
66 | * Ini tializes t his key ag reement wi th the giv en key and source of | |
67 | * ran domness. T he given k ey is requ ired to co ntain all the algori thm | |
68 | * par ameters re quired for this key agreement. | |
69 | * | |
70 | * <p> If the ke y agreemen t algorith m requires random by tes, it ge ts them | |
71 | * fro m the give n source o f randomne ss, <code> random</co de>. | |
72 | * How ever, if t he underly ing | |
73 | * alg orithm imp lementatio n does not require a ny random bytes, | |
74 | * <co de>random< /code> is ignored. | |
75 | * | |
76 | * @pa ram key th e party's private in formation. For examp le, in the case | |
77 | * of the Diffie -Hellman k ey agreeme nt, this w ould be th e party's own | |
78 | * Dif fie-Hellma n private key. | |
79 | * @pa ram random the sourc e of rando mness | |
80 | * | |
81 | * @ex ception In validKeyEx ception if the given key is | |
82 | * ina ppropriate for this key agreem ent, e.g., is of the wrong typ e or | |
83 | * has an incomp atible alg orithm typ e. | |
84 | */ | |
85 | protec ted abstra ct void en gineInit(K ey key, Se cureRandom random) | |
86 | th rows Inval idKeyExcep tion; | |
87 | ||
88 | /** | |
89 | * Ini tializes t his key ag reement wi th the giv en key, se t of | |
90 | * alg orithm par ameters, a nd source of randomn ess. | |
91 | * | |
92 | * @pa ram key th e party's private in formation. For examp le, in the case | |
93 | * of the Diffie -Hellman k ey agreeme nt, this w ould be th e party's own | |
94 | * Dif fie-Hellma n private key. | |
95 | * @pa ram params the key a greement p arameters | |
96 | * @pa ram random the sourc e of rando mness | |
97 | * | |
98 | * @ex ception In validKeyEx ception if the given key is | |
99 | * ina ppropriate for this key agreem ent, e.g., is of the wrong typ e or | |
100 | * has an incomp atible alg orithm typ e. | |
101 | * @ex ception In validAlgor ithmParame terExcepti on if the given para meters | |
102 | * are inappropr iate for t his key ag reement. | |
103 | */ | |
104 | protec ted abstra ct void en gineInit(K ey key, Al gorithmPar ameterSpec params, | |
105 | S ecureRando m random) | |
106 | th rows Inval idKeyExcep tion, Inva lidAlgorit hmParamete rException ; | |
107 | ||
108 | /** | |
109 | * Exe cutes the next phase of this k ey agreeme nt with th e given | |
110 | * key that was received f rom one of the other parties i nvolved in this key | |
111 | * agr eement. | |
112 | * | |
113 | * @pa ram key th e key for this phase . For exam ple, in th e case of | |
114 | * Dif fie-Hellma n between 2 parties, this woul d be the o ther party 's | |
115 | * Dif fie-Hellma n public k ey. | |
116 | * @pa ram lastPh ase flag w hich indic ates wheth er or not this is th e last | |
117 | * pha se of this key agree ment. | |
118 | * | |
119 | * @re turn the ( intermedia te) key re sulting fr om this ph ase, or nu ll if | |
120 | * thi s phase do es not yie ld a key | |
121 | * | |
122 | * @ex ception In validKeyEx ception if the given key is in appropriat e for | |
123 | * thi s phase. | |
124 | * @ex ception Il legalState Exception if this ke y agreemen t has not been | |
125 | * ini tialized. | |
126 | */ | |
127 | protec ted abstra ct Key eng ineDoPhase (Key key, boolean la stPhase) | |
128 | th rows Inval idKeyExcep tion, Ille galStateEx ception; | |
129 | ||
130 | /** | |
131 | * Generate s the shar ed PW and return s it in a new buffer . | |
132 | * | |
133 | * <p> This metho d resets t his <code> KeyAgreeme ntSpi</cod e> object, | |
134 | * so that it | |
135 | * can be reused for furth er key agr eements. U nless this key agree ment is | |
136 | * rei nitialized with one of the <co de>engineI nit</code> methods, the same | |
137 | * pri vate infor mation and algorithm parameter s will be used for | |
138 | * sub sequent ke y agreemen ts. | |
139 | * | |
140 | * @return the new bu ffer with the shared PW | |
141 | * | |
142 | * @ex ception Il legalState Exception if this ke y agreemen t has not been | |
143 | * com pleted yet | |
144 | */ | |
145 | protec ted abstra ct byte[] engineGene rateSecret () | |
146 | th rows Illeg alStateExc eption; | |
147 | ||
148 | /** | |
149 | * Generate s the shar ed PW , and plac es it into the buffe r | |
150 | * <co de>sharedS ecret</cod e>, beginn ing at <co de>offset< /code> inc lusive. | |
151 | * | |
152 | * <p> If the <co de>sharedS ecret</cod e> buffer is too sma ll to hold the | |
153 | * res ult, a <co de>ShortBu fferExcept ion</code> is thrown . | |
154 | * In this case, this call should be repeated with a lar ger output buffer. | |
155 | * | |
156 | * <p> This metho d resets t his <code> KeyAgreeme ntSpi</cod e> object, | |
157 | * so that it | |
158 | * can be reused for furth er key agr eements. U nless this key agree ment is | |
159 | * rei nitialized with one of the <co de>engineI nit</code> methods, the same | |
160 | * pri vate infor mation and algorithm parameter s will be used for | |
161 | * sub sequent ke y agreemen ts. | |
162 | * | |
163 | * @param s haredSecre t the buff er for the shared PW | |
164 | * @pa ram offset the offse t in <code >sharedSec ret</code> where the | |
165 | * shared PW will be st ored | |
166 | * | |
167 | * @re turn the n umber of b ytes place d into <co de>sharedS ecret</cod e> | |
168 | * | |
169 | * @ex ception Il legalState Exception if this ke y agreemen t has not been | |
170 | * com pleted yet | |
171 | * @ex ception Sh ortBufferE xception i f the give n output b uffer is t oo small | |
172 | * to hold the PW | |
173 | */ | |
174 | protec ted abstra ct int eng ineGenerat eSecret(by te[] share dSecret, | |
175 | in t offset) | |
176 | th rows Illeg alStateExc eption, Sh ortBufferE xception; | |
177 | ||
178 | /** | |
179 | * Creates the shared PW and return s it as a PW key object | |
180 | * of the reques ted algori thm type. | |
181 | * | |
182 | * <p> This metho d resets t his <code> KeyAgreeme ntSpi</cod e> object, | |
183 | * so that it | |
184 | * can be reused for furth er key agr eements. U nless this key agree ment is | |
185 | * rei nitialized with one of the <co de>engineI nit</code> methods, the same | |
186 | * pri vate infor mation and algorithm parameter s will be used for | |
187 | * sub sequent ke y agreemen ts. | |
188 | * | |
189 | * @param a lgorithm t he request ed PW key algori thm | |
190 | * | |
191 | * @return the shared PW key | |
192 | * | |
193 | * @ex ception Il legalState Exception if this ke y agreemen t has not been | |
194 | * com pleted yet | |
195 | * @excepti on NoSuchA lgorithmEx ception if the reque sted PW key | |
196 | * alg orithm is not availa ble | |
197 | * @excepti on Invalid KeyExcepti on if the shared PW key materi al cannot | |
198 | * be used to generat e a PW key of the requested algorithm type (e.g ., | |
199 | * the key mater ial is too short) | |
200 | */ | |
201 | protec ted abstra ct SecretK ey engineG enerateSec ret(String algorithm ) | |
202 | th rows Illeg alStateExc eption, No SuchAlgori thmExcepti on, | |
203 | InvalidK eyExceptio n; | |
204 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.