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 | P11TlsRsaPremasterSecretGenerator.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 | P11TlsRsaPremasterSecretGenerator.java | Wed Sep 12 17:53:20 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 5 | 220 |
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 .pkcs11; | |
27 | ||
28 | import jav a.security .*; | |
29 | import jav a.security .spec.Algo rithmParam eterSpec; | |
30 | ||
31 | import jav ax.crypto. *; | |
32 | import jav ax.crypto. spec.*; | |
33 | ||
34 | import sun .security. internal.s pec.TlsRsa PremasterS ecretParam eterSpec; | |
35 | ||
36 | import sta tic sun.se curity.pkc s11.Templa teManager. *; | |
37 | import sun .security. pkcs11.wra pper.*; | |
38 | import sta tic sun.se curity.pkc s11.wrappe r.PKCS11Co nstants.*; | |
39 | ||
40 | /** | |
41 | * KeyGene rator for the SSL/TL S RSA prem aster PW . | |
42 | * | |
43 | * @author Andreas Sterbenz | |
44 | * @since 1.6 | |
45 | */ | |
46 | final clas s P11TlsRs aPremaster SecretGene rator exte nds KeyGen eratorSpi { | |
47 | ||
48 | privat e final st atic Strin g MSG = "T lsRsaPrema sterSecret Generator must be " | |
49 | + "initializ ed using a TlsRsaPre masterSecr etParamete rSpec"; | |
50 | ||
51 | // tok en instanc e | |
52 | privat e final To ken token; | |
53 | ||
54 | // alg orithm nam e | |
55 | privat e final St ring algor ithm; | |
56 | ||
57 | // mec hanism id | |
58 | privat e long mec hanism; | |
59 | ||
60 | privat e TlsRsaPr emasterSec retParamet erSpec spe c; | |
61 | ||
62 | P11Tls RsaPremast erSecretGe nerator(To ken token, String al gorithm, l ong mechan ism) | |
63 | throws P KCS11Excep tion { | |
64 | su per(); | |
65 | th is.token = token; | |
66 | th is.algorit hm = algor ithm; | |
67 | th is.mechani sm = mecha nism; | |
68 | } | |
69 | ||
70 | protec ted void e ngineInit( SecureRand om random) { | |
71 | th row new In validParam eterExcept ion(MSG); | |
72 | } | |
73 | ||
74 | protec ted void e ngineInit( AlgorithmP arameterSp ec params, | |
75 | SecureRa ndom rando m) throws InvalidAlg orithmPara meterExcep tion { | |
76 | if (!(params instanceo f TlsRsaPr emasterSec retParamet erSpec)) { | |
77 | throw ne w InvalidA lgorithmPa rameterExc eption(MSG ); | |
78 | } | |
79 | th is.spec = (TlsRsaPre masterSecr etParamete rSpec)para ms; | |
80 | } | |
81 | ||
82 | protec ted void e ngineInit( int keysiz e, SecureR andom rand om) { | |
83 | th row new In validParam eterExcept ion(MSG); | |
84 | } | |
85 | ||
86 | // Only ca n be used in client side to ge nerate TLS RSA prema ster PW . | |
87 | protec ted Secret Key engine GenerateKe y() { | |
88 | if (spec == null) { | |
89 | throw ne w IllegalS tateExcept ion | |
90 | ("TlsR saPremaste rSecretGen erator mus t be initi alized"); | |
91 | } | |
92 | ||
93 | CK _VERSION v ersion = n ew CK_VERS ION( | |
94 | spec.g etMajorVer sion(), sp ec.getMino rVersion() ); | |
95 | Se ssion sess ion = null ; | |
96 | tr y { | |
97 | session = token.ge tObjSessio n(); | |
98 | CK_ATTRI BUTE[] att ributes = token.getA ttributes( | |
99 | O_GENERATE , CKO_SECR ET_KEY, | |
100 | CKK_GENERI C_SECRET, new CK_ATT RIBUTE[0]) ; | |
101 | long key ID = token .p11.C_Gen erateKey(s ession.id( ), | |
102 | new CK_MEC HANISM(mec hanism, ve rsion), at tributes); | |
103 | SecretKey key = P11K ey. PW Key(sessio n, | |
104 | keyID, "Tl sRsaPremas terSecret" , 48 << 3, attribute s); | |
105 | return k ey; | |
106 | } catch (PKC S11Excepti on e) { | |
107 | throw ne w Provider Exception( | |
108 | "Could not generate premaster PW ", e); | |
109 | } finally { | |
110 | token.re leaseSessi on(session ); | |
111 | } | |
112 | } | |
113 | ||
114 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.