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\pkcs11\wrapper | PKCS11.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\wrapper | PKCS11.java | Wed Sep 12 17:53:36 2018 UTC |
Description | Between Files 1 and 2 |
|
---|---|---|
Text Blocks | Lines | |
Unchanged | 4 | 3642 |
Changed | 3 | 6 |
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, 2013, O racle and/ or its aff iliates. A ll rights reserved. | |
3 | */ | |
4 | ||
5 | /* Copyrig ht (c) 20 02 Graz Un iversity o f Technolo gy. All ri ghts reser ved. | |
6 | * | |
7 | * Redistr ibution an d use in source and binary fo rms, with or without | |
8 | * modific ation, are permitted provided that the following conditions are met: | |
9 | * | |
10 | * 1. Redi stribution s of sour ce code mu st retain the above copyright notice, | |
11 | * this list of c onditions and the fo llowing di sclaimer. | |
12 | * | |
13 | * 2. Redi stribution s in bina ry form mu st reprodu ce the abo ve copyrig ht notice, | |
14 | * this list of c onditions and the fo llowing di sclaimer i n the docu mentation | |
15 | * and/ or other m aterials p rovided wi th the dis tribution. | |
16 | * | |
17 | * 3. The end-user d ocumentati on include d with the redistrib ution, if any, must | |
18 | * incl ude the fo llowing ac knowledgme nt: | |
19 | * | |
20 | * "Thi s product includes s oftware de veloped by IAIK of G raz Univer sity of | |
21 | * Tec hnology." | |
22 | * | |
23 | * Alte rnately, t his acknow ledgment m ay appear in the sof tware itse lf, if | |
24 | * and wherever s uch third- party ackn owledgment s normally appear. | |
25 | * | |
26 | * 4. The names "Gra z Universi ty of Tech nology" an d "IAIK of Graz Univ ersity of | |
27 | * Tech nology" mu st not be used to en dorse or p romote pro ducts deri ved from | |
28 | * this software without pr ior writte n permissi on. | |
29 | * | |
30 | * 5. Prod ucts deriv ed from th is softwar e may not be called | |
31 | * "IAI K PKCS Wra pper", nor may "IAIK " appear i n their na me, withou t prior | |
32 | * writ ten permis sion of Gr az Univers ity of Tec hnology. | |
33 | * | |
34 | * THIS S OFTWARE IS PROVIDED "AS IS" AN D ANY EXPR ESSED OR I MPLIED | |
35 | * WARRAN TIES, INCL UDING, BUT NOT LIMIT ED TO, THE IMPLIED | |
36 | * WARRAN TIES OF ME RCHANTABIL ITY AND FI TNESS FOR A PARTICUL AR | |
37 | * PURPOS E ARE DISC LAIMED. IN NO EVENT SHALL THE LICENSOR B E | |
38 | * LIABLE FOR ANY D IRECT, IND IRECT, INC IDENTAL, S PECIAL, EX EMPLARY, | |
39 | * OR CON SEQUENTIAL DAMAGES ( INCLUDING, BUT NOT L IMITED TO, | |
40 | * PROCUR EMENT OF S UBSTITUTE GOODS OR S ERVICES; L OSS OF USE , DATA, | |
41 | * OR PRO FITS; OR B USINESS IN TERRUPTION ) HOWEVER CAUSED AND ON | |
42 | * ANY TH EORY OF LI ABILITY, W HETHER IN CONTRACT, STRICT LIA BILITY, | |
43 | * OR TOR T (INCLUDI NG NEGLIGE NCE OR OTH ERWISE) AR ISING IN A NY WAY | |
44 | * OUT OF THE USE O F THIS SOF TWARE, EVE N IF ADVIS ED OF THE | |
45 | * POSSIB ILITY OF SUCH DAMAG E. | |
46 | */ | |
47 | ||
48 | package su n.security .pkcs11.wr apper; | |
49 | ||
50 | import jav a.io.File; | |
51 | import jav a.io.IOExc eption; | |
52 | import jav a.util.*; | |
53 | ||
54 | import jav a.security .AccessCon troller; | |
55 | import jav a.security .Privilege dAction; | |
56 | ||
57 | import sta tic sun.se curity.pkc s11.wrappe r.PKCS11Co nstants.*; | |
58 | ||
59 | /** | |
60 | * This is the defau lt impleme ntation of the PKCS1 1 interfac e. IT conn ects to | |
61 | * the pkc s11wrapper .dll file, which is the native part of t his librar y. | |
62 | * The str ange and a wkward loo king initi alization was chosen to avoid calling | |
63 | * loadLib rary from a static i nitializat ion block, because t his would complicate | |
64 | * the use in applet s. | |
65 | * | |
66 | * @author Karl Sche ibelhofer <Karl.Sche ibelhofer@ iaik.at> | |
67 | * @author Martin Sc hlaeffer < schlaeff@s box.tugraz .at> | |
68 | * @invari ants (pkcs 11ModulePa th_ <> nul l) | |
69 | */ | |
70 | public cla ss PKCS11 { | |
71 | ||
72 | /** | |
73 | * The name of t he native part of th e wrapper; i.e. the filename w ithout | |
74 | * the extension (e.g. ".D LL" or ".s o"). | |
75 | */ | |
76 | privat e static f inal Strin g PKCS11_W RAPPER = " j2pkcs11"; | |
77 | ||
78 | static { | |
79 | // cannot us e LoadLibr aryAction because th at would m ake the na tive | |
80 | // library a vailable t o the boot classloade r, but we run in the | |
81 | // extension classload er. | |
82 | Ac cessContro ller.doPri vileged(ne w Privileg edAction<O bject>() { | |
83 | public O bject run( ) { | |
84 | Syst em.loadLib rary(PKCS1 1_WRAPPER) ; | |
85 | retu rn null; | |
86 | } | |
87 | }) ; | |
88 | in itializeLi brary(); | |
89 | } | |
90 | ||
91 | public static vo id loadNat ive() { | |
92 | // dummy met hod that c an be call ed to make sure the native | |
93 | // portion h as been lo aded. actu al loading happens i n the | |
94 | // static in itializer, hence thi s method i s empty. | |
95 | } | |
96 | ||
97 | /** | |
98 | * The PKCS#11 m odule to c onnect to. This is t he PKCS#11 driver of the token ; | |
99 | * e.g . pk2priv. dll. | |
100 | */ | |
101 | privat e final St ring pkcs1 1ModulePat h; | |
102 | ||
103 | privat e long pNa tiveData; | |
104 | ||
105 | /** | |
106 | * Thi s method d oes the in itializati on of the native lib rary. It i s called | |
107 | * exa ctly once for this c lass. | |
108 | * | |
109 | * @pr econdition s | |
110 | * @po stconditio ns | |
111 | */ | |
112 | privat e static n ative void initializ eLibrary() ; | |
113 | ||
114 | // XXX | |
115 | /** | |
116 | * Thi s method d oes the fi nalization of the na tive libra ry. It is called | |
117 | * exa ctly once for this c lass. The library us es this me thod for a clean-up | |
118 | * of any resour ces. | |
119 | * | |
120 | * @pr econdition s | |
121 | * @po stconditio ns | |
122 | */ | |
123 | privat e static n ative void finalizeL ibrary(); | |
124 | ||
125 | privat e static f inal Map<S tring,PKCS 11> module Map = | |
126 | ne w HashMap< String,PKC S11>(); | |
127 | ||
128 | /** | |
129 | * Con nects to t he PKCS#11 driver gi ven. The f ilename mu st contain the | |
130 | * pat h, if the driver is not in the system's search pat h. | |
131 | * | |
132 | * @pa ram pkcs11 ModulePath the PKCS# 11 library path | |
133 | * @pr econdition s (pkcs11M odulePath <> null) | |
134 | * @po stconditio ns | |
135 | */ | |
136 | PKCS11 (String pk cs11Module Path, Stri ng functio nListName) | |
137 | throws I OException { | |
138 | co nnect(pkcs 11ModulePa th, functi onListName ); | |
139 | th is.pkcs11M odulePath = pkcs11Mo dulePath; | |
140 | } | |
141 | ||
142 | public static sy nchronized PKCS11 ge tInstance( String pkc s11ModuleP ath, | |
143 | String f unctionLis t, CK_C_IN ITIALIZE_A RGS pInitA rgs, | |
144 | boolean omitInitia lize) thro ws IOExcep tion, PKCS 11Exceptio n { | |
145 | // we may on ly call C_ Initialize once per native .so /.dll | |
146 | // so keep a cache usi ng the (no n-canonica lized!) pa th | |
147 | PK CS11 pkcs1 1 = module Map.get(pk cs11Module Path); | |
148 | if (pkcs11 = = null) { | |
149 | if ((pIn itArgs != null) | |
150 | && ((pInit Args.flags & CKF_OS_ LOCKING_OK ) != 0)) { | |
151 | pkcs 11 = new P KCS11(pkcs 11ModulePa th, functi onList); | |
152 | } else { | |
153 | pkcs 11 = new S ynchronize dPKCS11(pk cs11Module Path, func tionList); | |
154 | } | |
155 | if (omit Initialize == false) { | |
156 | try { | |
157 | pkcs11.C_I nitialize( pInitArgs) ; | |
158 | } ca tch (PKCS1 1Exception e) { | |
159 | // ignore already-in itialized error code | |
160 | // rethrow all other errors | |
161 | if (e.getE rrorCode() != CKR_CR YPTOKI_ALR EADY_INITI ALIZED) { | |
162 | throw e; | |
163 | } | |
164 | } | |
165 | } | |
166 | moduleMa p.put(pkcs 11ModulePa th, pkcs11 ); | |
167 | } | |
168 | re turn pkcs1 1; | |
169 | } | |
170 | ||
171 | /** | |
172 | * Con nects this object to the speci fied PKCS# 11 library . This met hod is for | |
173 | * int ernal use only. | |
174 | * Dec lared priv ate, becau se incorre ct handlin g may resu lt in erro rs in the | |
175 | * nat ive part. | |
176 | * | |
177 | * @pa ram pkcs11 ModulePath The PKCS# 11 library path. | |
178 | * @pr econdition s (pkcs11M odulePath <> null) | |
179 | * @po stconditio ns | |
180 | */ | |
181 | privat e native v oid connec t(String p kcs11Modul ePath, Str ing functi onListName ) | |
182 | throws I OException ; | |
183 | ||
184 | /** | |
185 | * Dis connects t he PKCS#11 library f rom this o bject. Aft er calling this | |
186 | * met hod, this object is no longer connected to a nativ e PKCS#11 module | |
187 | * and any subse quent call s to C_ me thods will fail. Thi s method i s for | |
188 | * int ernal use only. | |
189 | * Dec lared priv ate, becau se incorre ct handlin g may resu lt in erro rs in the | |
190 | * nat ive part. | |
191 | * | |
192 | * @pr econdition s | |
193 | * @po stconditio ns | |
194 | */ | |
195 | privat e native v oid discon nect(); | |
196 | ||
197 | ||
198 | // Imp lementatio n of PKCS1 1 methods delegated to native pkcs11wrap per librar y | |
199 | ||
200 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
201 | * General -purpose | |
202 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
203 | ||
204 | /** | |
205 | * C_I nitialize initialize s the Cryp toki libra ry. | |
206 | * (Ge neral-purp ose) | |
207 | * | |
208 | * @pa ram pInitA rgs if pIn itArgs is not NULL i t gets cas ted to | |
209 | * CK_C_ INITIALIZE _ARGS_PTR and derefe renced | |
210 | * (PKCS #11 param: CK_VOID_P TR pInitAr gs) | |
211 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
212 | * @pr econdition s | |
213 | * @po stconditio ns | |
214 | */ | |
215 | native void C_In itialize(O bject pIni tArgs) thr ows PKCS11 Exception; | |
216 | ||
217 | /** | |
218 | * C_F inalize in dicates th at an appl ication is done with the | |
219 | * Cry ptoki libr ary | |
220 | * (Ge neral-purp ose) | |
221 | * | |
222 | * @pa ram pReser ved is res erved. Sho uld be NUL L_PTR | |
223 | * (PKCS #11 param: CK_VOID_P TR pReserv ed) | |
224 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
225 | * @pr econdition s (pReserv ed == null ) | |
226 | * @po stconditio ns | |
227 | */ | |
228 | public native vo id C_Final ize(Object pReserved ) throws P KCS11Excep tion; | |
229 | ||
230 | ||
231 | /** | |
232 | * C_G etInfo ret urns gener al informa tion about Cryptoki. | |
233 | * (Ge neral-purp ose) | |
234 | * | |
235 | * @re turn the i nformation . | |
236 | * (PKCS #11 param: CK_INFO_P TR pInfo) | |
237 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
238 | * @pr econdition s | |
239 | * @po stconditio ns (result <> null) | |
240 | */ | |
241 | public native CK _INFO C_Ge tInfo() th rows PKCS1 1Exception ; | |
242 | ||
243 | ||
244 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
245 | * Slot an d token ma nagement | |
246 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
247 | ||
248 | /** | |
249 | * C_G etSlotList obtains a list of s lots in th e system. | |
250 | * (Sl ot and tok en managem ent) | |
251 | * | |
252 | * @pa ram tokenP resent if true only Slot IDs w ith a toke n are retu rned | |
253 | * (PKCS #11 param: CK_BBOOL tokenPrese nt) | |
254 | * @re turn a lon g array of slot IDs and number of Slot I Ds | |
255 | * (PKCS #11 param: CK_SLOT_I D_PTR pSlo tList, CK_ ULONG_PTR pulCount) | |
256 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
257 | * @pr econdition s | |
258 | * @po stconditio ns (result <> null) | |
259 | */ | |
260 | public native lo ng[] C_Get SlotList(b oolean tok enPresent) | |
261 | throws P KCS11Excep tion; | |
262 | ||
263 | ||
264 | /** | |
265 | * C_G etSlotInfo obtains i nformation about a p articular slot in | |
266 | * the system. | |
267 | * (Sl ot and tok en managem ent) | |
268 | * | |
269 | * @pa ram slotID the ID of the slot | |
270 | * (PKCS #11 param: CK_SLOT_I D slotID) | |
271 | * @re turn the s lot inform ation | |
272 | * (PKCS #11 param: CK_SLOT_I NFO_PTR pI nfo) | |
273 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
274 | * @pr econdition s | |
275 | * @po stconditio ns (result <> null) | |
276 | */ | |
277 | public native CK _SLOT_INFO C_GetSlot Info(long slotID) th rows PKCS1 1Exception ; | |
278 | ||
279 | ||
280 | /** | |
281 | * C_G etTokenInf o obtains informatio n about a particular token | |
282 | * in the system . | |
283 | * (Sl ot and tok en managem ent) | |
284 | * | |
285 | * @pa ram slotID ID of the token's s lot | |
286 | * (PKCS #11 param: CK_SLOT_I D slotID) | |
287 | * @re turn the t oken infor mation | |
288 | * (PKCS #11 param: CK_TOKEN_ INFO_PTR p Info) | |
289 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
290 | * @pr econdition s | |
291 | * @po stconditio ns (result <> null) | |
292 | */ | |
293 | public native CK _TOKEN_INF O C_GetTok enInfo(lon g slotID) | |
294 | throws P KCS11Excep tion; | |
295 | ||
296 | ||
297 | /** | |
298 | * C_G etMechanis mList obta ins a list of mechan ism types | |
299 | * sup ported by a token. | |
300 | * (Sl ot and tok en managem ent) | |
301 | * | |
302 | * @pa ram slotID ID of the token's s lot | |
303 | * (PKCS #11 param: CK_SLOT_I D slotID) | |
304 | * @re turn a lon g array of mechanism types and number of mechanism types | |
305 | * (PKCS #11 param: CK_MECHAN ISM_TYPE_P TR pMechan ismList, | |
306 | * CK_ULONG_ PTR pulCou nt) | |
307 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
308 | * @pr econdition s | |
309 | * @po stconditio ns (result <> null) | |
310 | */ | |
311 | public native lo ng[] C_Get MechanismL ist(long s lotID) thr ows PKCS11 Exception; | |
312 | ||
313 | ||
314 | /** | |
315 | * C_G etMechanis mInfo obta ins inform ation abou t a partic ular | |
316 | * mec hanism pos sibly supp orted by a token. | |
317 | * (Sl ot and tok en managem ent) | |
318 | * | |
319 | * @pa ram slotID ID of the token's s lot | |
320 | * (PKCS #11 param: CK_SLOT_I D slotID) | |
321 | * @pa ram type t ype of mec hanism | |
322 | * (PKCS #11 param: CK_MECHAN ISM_TYPE t ype) | |
323 | * @re turn the m echanism i nfo | |
324 | * (PKCS #11 param: CK_MECHAN ISM_INFO_P TR pInfo) | |
325 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
326 | * @pr econdition s | |
327 | * @po stconditio ns (result <> null) | |
328 | */ | |
329 | public native CK _MECHANISM _INFO C_Ge tMechanism Info(long slotID, lo ng type) | |
330 | throws P KCS11Excep tion; | |
331 | ||
332 | ||
333 | /** | |
334 | * C_I nitToken i nitializes a token. | |
335 | * (Sl ot and tok en managem ent) | |
336 | * | |
337 | * @pa ram slotID ID of the token's s lot | |
338 | * (PKCS #11 param: CK_SLOT_I D slotID) | |
339 | * @pa ram pPin t he SO's in itial PIN and the le ngth in by tes of the PIN | |
340 | * (PKCS #11 param: CK_CHAR_P TR pPin, C K_ULONG ul PinLen) | |
341 | * @pa ram pLabel 32-byte t oken label (blank pa dded) | |
342 | * (PKCS #11 param: CK_UTF8CH AR_PTR pLa bel) | |
343 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
344 | * @pr econdition s | |
345 | * @po stconditio ns | |
346 | */ | |
347 | // publ ic native void C_Ini tToken(lon g slotID, char[] pPi n, char[] pLabel) | |
348 | // throws PKCS11Exc eption; | |
349 | ||
350 | ||
351 | /** | |
352 | * C_I nitPIN ini tializes t he normal user's PIN . | |
353 | * (Sl ot and tok en managem ent) | |
354 | * | |
355 | * @pa ram hSessi on the ses sion's han dle | |
356 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
357 | * @pa ram pPin t he normal user's PIN and the l ength in b ytes of th e PIN | |
358 | * (PKCS #11 param: CK_CHAR_P TR pPin, C K_ULONG ul PinLen) | |
359 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
360 | * @pr econdition s | |
361 | * @po stconditio ns | |
362 | */ | |
363 | // publ ic native void C_Ini tPIN(long hSession, char[] pPi n) | |
364 | // throws PKCS11Exc eption; | |
365 | ||
366 | ||
367 | /** | |
368 | * C_S etPIN modi fies the P IN of the user who i s logged i n. | |
369 | * (Sl ot and tok en managem ent) | |
370 | * | |
371 | * @pa ram hSessi on the ses sion's han dle | |
372 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
373 | * @pa ram pOldPi n the old PIN and th e length o f the old PIN | |
374 | * (PKCS #11 param: CK_CHAR_P TR pOldPin , CK_ULONG ulOldLen) | |
375 | * @pa ram pNewPi n the new PIN and th e length o f the new PIN | |
376 | * (PKCS #11 param: CK_CHAR_P TR pNewPin , CK_ULONG ulNewLen) | |
377 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
378 | * @pr econdition s | |
379 | * @po stconditio ns | |
380 | */ | |
381 | // publ ic native void C_Set PIN(long h Session, c har[] pOld Pin, char[ ] pNewPin) | |
382 | // throws PKCS11Exc eption; | |
383 | ||
384 | ||
385 | ||
386 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
387 | * Session managemen t | |
388 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
389 | ||
390 | /** | |
391 | * C_O penSession opens a s ession bet ween an ap plication and a | |
392 | * tok en. | |
393 | * (Se ssion mana gement) | |
394 | * | |
395 | * @pa ram slotID the slot' s ID | |
396 | * (PKCS #11 param: CK_SLOT_I D slotID) | |
397 | * @pa ram flags of CK_SESS ION_INFO | |
398 | * (PKCS #11 param: CK_FLAGS flags) | |
399 | * @pa ram pAppli cation pas sed to cal lback | |
400 | * (PKCS #11 param: CK_VOID_P TR pApplic ation) | |
401 | * @pa ram Notify the callb ack functi on | |
402 | * (PKCS #11 param: CK_NOTIFY Notify) | |
403 | * @re turn the s ession han dle | |
404 | * (PKCS #11 param: CK_SESSIO N_HANDLE_P TR phSessi on) | |
405 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
406 | * @pr econdition s | |
407 | * @po stconditio ns | |
408 | */ | |
409 | public native lo ng C_OpenS ession(lon g slotID, long flags , | |
410 | Object p Applicatio n, CK_NOTI FY Notify) throws PK CS11Except ion; | |
411 | ||
412 | ||
413 | /** | |
414 | * C_C loseSessio n closes a session b etween an applicatio n and a | |
415 | * tok en. | |
416 | * (Se ssion mana gement) | |
417 | * | |
418 | * @pa ram hSessi on the ses sion's han dle | |
419 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
420 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
421 | * @pr econdition s | |
422 | * @po stconditio ns | |
423 | */ | |
424 | public native vo id C_Close Session(lo ng hSessio n) throws PKCS11Exce ption; | |
425 | ||
426 | ||
427 | /** | |
428 | * C_C loseAllSes sions clos es all ses sions with a token. | |
429 | * (Se ssion mana gement) | |
430 | * | |
431 | * @pa ram slotID the ID of the token 's slot | |
432 | * (PKCS #11 param: CK_SLOT_I D slotID) | |
433 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
434 | * @pr econdition s | |
435 | * @po stconditio ns | |
436 | */ | |
437 | // publ ic native void C_Clo seAllSessi ons(long s lotID) thr ows PKCS11 Exception; | |
438 | ||
439 | ||
440 | /** | |
441 | * C_G etSessionI nfo obtain s informat ion about the sessio n. | |
442 | * (Se ssion mana gement) | |
443 | * | |
444 | * @pa ram hSessi on the ses sion's han dle | |
445 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
446 | * @re turn the s ession inf o | |
447 | * (PKCS #11 param: CK_SESSIO N_INFO_PTR pInfo) | |
448 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
449 | * @pr econdition s | |
450 | * @po stconditio ns (result <> null) | |
451 | */ | |
452 | public native CK _SESSION_I NFO C_GetS essionInfo (long hSes sion) | |
453 | throws P KCS11Excep tion; | |
454 | ||
455 | ||
456 | /** | |
457 | * C_G etOperatio nState obt ains the s tate of th e cryptogr aphic oper ation | |
458 | * in a session. | |
459 | * (Se ssion mana gement) | |
460 | * | |
461 | * @pa ram hSessi on session 's handle | |
462 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
463 | * @re turn the s tate and t he state l ength | |
464 | * (PKCS #11 param: CK_BYTE_P TR pOperat ionState, | |
465 | * CK_ULONG_ PTR pulOpe rationStat eLen) | |
466 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
467 | * @pr econdition s | |
468 | * @po stconditio ns (result <> null) | |
469 | */ | |
470 | public native by te[] C_Get OperationS tate(long hSession) | |
471 | throws P KCS11Excep tion; | |
472 | ||
473 | ||
474 | /** | |
475 | * C_S etOperatio nState res tores the state of t he cryptog raphic | |
476 | * ope ration in a session. | |
477 | * (Se ssion mana gement) | |
478 | * | |
479 | * @pa ram hSessi on session 's handle | |
480 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
481 | * @pa ram pOpera tionState the state and the st ate length | |
482 | * (PKCS #11 param: CK_BYTE_P TR pOperat ionState, | |
483 | * CK_ULONG ulOperatio nStateLen) | |
484 | * @pa ram hEncry ptionKey e n/decrypti on key | |
485 | * (PKCS #11 param: CK_OBJECT _HANDLE hE ncryptionK ey) | |
486 | * @pa ram hAuthe nticationK ey sign/ve rify key | |
487 | * (PKCS #11 param: CK_OBJECT _HANDLE hA uthenticat ionKey) | |
488 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
489 | * @pr econdition s | |
490 | * @po stconditio ns | |
491 | */ | |
492 | public native vo id C_SetOp erationSta te(long hS ession, by te[] pOper ationState , | |
493 | long hEn cryptionKe y, long hA uthenticat ionKey) th rows PKCS1 1Exception ; | |
494 | ||
495 | ||
496 | /** | |
497 | * C_L ogin logs a user int o a token. | |
498 | * (Se ssion mana gement) | |
499 | * | |
500 | * @pa ram hSessi on the ses sion's han dle | |
501 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
502 | * @pa ram userTy pe the use r type | |
503 | * (PKCS #11 param: CK_USER_T YPE userTy pe) | |
504 | * @pa ram pPin t he user's PIN and th e length o f the PIN | |
505 | * (PKCS #11 param: CK_CHAR_P TR pPin, C K_ULONG ul PinLen) | |
506 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
507 | * @pr econdition s | |
508 | * @po stconditio ns | |
509 | */ | |
510 | public native vo id C_Login (long hSes sion, long userType, char[] pP in) | |
511 | throws P KCS11Excep tion; | |
512 | ||
513 | ||
514 | /** | |
515 | * C_L ogout logs a user ou t from a t oken. | |
516 | * (Se ssion mana gement) | |
517 | * | |
518 | * @pa ram hSessi on the ses sion's han dle | |
519 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
520 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
521 | * @pr econdition s | |
522 | * @po stconditio ns | |
523 | */ | |
524 | public native vo id C_Logou t(long hSe ssion) thr ows PKCS11 Exception; | |
525 | ||
526 | ||
527 | ||
528 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
529 | * Object management | |
530 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
531 | ||
532 | /** | |
533 | * C_C reateObjec t creates a new obje ct. | |
534 | * (Ob ject manag ement) | |
535 | * | |
536 | * @pa ram hSessi on the ses sion's han dle | |
537 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
538 | * @pa ram pTempl ate the ob ject's tem plate and number of attributes in | |
539 | * templ ate | |
540 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pT emplate, C K_ULONG ul Count) | |
541 | * @re turn the o bject's ha ndle | |
542 | * (PKCS #11 param: CK_OBJECT _HANDLE_PT R phObject ) | |
543 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
544 | * @pr econdition s | |
545 | * @po stconditio ns | |
546 | */ | |
547 | public native lo ng C_Creat eObject(lo ng hSessio n, CK_ATTR IBUTE[] pT emplate) | |
548 | throws P KCS11Excep tion; | |
549 | ||
550 | ||
551 | /** | |
552 | * C_C opyObject copies an object, cr eating a n ew object for the | |
553 | * cop y. | |
554 | * (Ob ject manag ement) | |
555 | * | |
556 | * @pa ram hSessi on the ses sion's han dle | |
557 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
558 | * @pa ram hObjec t the obje ct's handl e | |
559 | * (PKCS #11 param: CK_OBJECT _HANDLE hO bject) | |
560 | * @pa ram pTempl ate the te mplate for the new o bject and number of attributes | |
561 | * in te mplate | |
562 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pT emplate, C K_ULONG ul Count) | |
563 | * @re turn the h andle of t he copy | |
564 | * (PKCS #11 param: CK_OBJECT _HANDLE_PT R phNewObj ect) | |
565 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
566 | * @pr econdition s | |
567 | * @po stconditio ns | |
568 | */ | |
569 | public native lo ng C_CopyO bject(long hSession, long hObj ect, | |
570 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception ; | |
571 | ||
572 | ||
573 | /** | |
574 | * C_D estroyObje ct destroy s an objec t. | |
575 | * (Ob ject manag ement) | |
576 | * | |
577 | * @pa ram hSessi on the ses sion's han dle | |
578 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
579 | * @pa ram hObjec t the obje ct's handl e | |
580 | * (PKCS #11 param: CK_OBJECT _HANDLE hO bject) | |
581 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
582 | * @pr econdition s | |
583 | * @po stconditio ns | |
584 | */ | |
585 | public native vo id C_Destr oyObject(l ong hSessi on, long h Object) | |
586 | throws P KCS11Excep tion; | |
587 | ||
588 | ||
589 | /** | |
590 | * C_G etObjectSi ze gets th e size of an object in bytes. | |
591 | * (Ob ject manag ement) | |
592 | * | |
593 | * @pa ram hSessi on the ses sion's han dle | |
594 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
595 | * @pa ram hObjec t the obje ct's handl e | |
596 | * (PKCS #11 param: CK_OBJECT _HANDLE hO bject) | |
597 | * @re turn the s ize of the object | |
598 | * (PKCS #11 param: CK_ULONG_ PTR pulSiz e) | |
599 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
600 | * @pr econdition s | |
601 | * @po stconditio ns | |
602 | */ | |
603 | // publ ic native long C_Get ObjectSize (long hSes sion, long hObject) | |
604 | // throws PKCS11Exc eption; | |
605 | ||
606 | ||
607 | /** | |
608 | * C_G etAttribut eValue obt ains the v alue of on e or more object | |
609 | * att ributes. T he templat e attribut es also re ceive the values. | |
610 | * (Ob ject manag ement) | |
611 | * not e: in PKCS #11 pTempl ate and th e result t emplate ar e the same | |
612 | * | |
613 | * @pa ram hSessi on the ses sion's han dle | |
614 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
615 | * @pa ram hObjec t the obje ct's handl e | |
616 | * (PKCS #11 param: CK_OBJECT _HANDLE hO bject) | |
617 | * @pa ram pTempl ate specif ies the at tributes a nd number of attribu tes to get | |
618 | * The te mplate att ributes al so receive the value s. | |
619 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pT emplate, C K_ULONG ul Count) | |
620 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
621 | * @pr econdition s (pTempla te <> null ) | |
622 | * @po stconditio ns (result <> null) | |
623 | */ | |
624 | public native vo id C_GetAt tributeVal ue(long hS ession, lo ng hObject , | |
625 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception ; | |
626 | ||
627 | ||
628 | /** | |
629 | * C_S etAttribut eValue mod ifies the value of o ne or more object | |
630 | * att ributes | |
631 | * (Ob ject manag ement) | |
632 | * | |
633 | * @pa ram hSessi on the ses sion's han dle | |
634 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
635 | * @pa ram hObjec t the obje ct's handl e | |
636 | * (PKCS #11 param: CK_OBJECT _HANDLE hO bject) | |
637 | * @pa ram pTempl ate specif ies the at tributes a nd values to get; nu mber of | |
638 | * attri butes in t he templat e | |
639 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pT emplate, C K_ULONG ul Count) | |
640 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
641 | * @pr econdition s (pTempla te <> null ) | |
642 | * @po stconditio ns | |
643 | */ | |
644 | public native vo id C_SetAt tributeVal ue(long hS ession, lo ng hObject , | |
645 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception ; | |
646 | ||
647 | ||
648 | /** | |
649 | * C_F indObjects Init initi alizes a s earch for token and session | |
650 | * obj ects that match a te mplate. | |
651 | * (Ob ject manag ement) | |
652 | * | |
653 | * @pa ram hSessi on the ses sion's han dle | |
654 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
655 | * @pa ram pTempl ate the ob ject's att ribute val ues to mat ch and the number of | |
656 | * attri butes in s earch temp late | |
657 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pT emplate, C K_ULONG ul Count) | |
658 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
659 | * @pr econdition s | |
660 | * @po stconditio ns | |
661 | */ | |
662 | public native vo id C_FindO bjectsInit (long hSes sion, CK_A TTRIBUTE[] pTemplate ) | |
663 | throws P KCS11Excep tion; | |
664 | ||
665 | ||
666 | /** | |
667 | * C_F indObjects continues a search for token and sessio n | |
668 | * obj ects that match a te mplate, ob taining ad ditional o bject | |
669 | * han dles. | |
670 | * (Ob ject manag ement) | |
671 | * | |
672 | * @pa ram hSessi on the ses sion's han dle | |
673 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
674 | * @pa ram ulMaxO bjectCount the max. object han dles to ge t | |
675 | * (PKCS #11 param: CK_ULONG ulMaxObjec tCount) | |
676 | * @re turn the o bject's ha ndles and the actual number of objects r eturned | |
677 | * (PKCS #11 param: CK_ULONG_ PTR pulObj ectCount) | |
678 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
679 | * @pr econdition s | |
680 | * @po stconditio ns (result <> null) | |
681 | */ | |
682 | public native lo ng[] C_Fin dObjects(l ong hSessi on, long u lMaxObject Count) | |
683 | throws P KCS11Excep tion; | |
684 | ||
685 | ||
686 | /** | |
687 | * C_F indObjects Final fini shes a sea rch for to ken and se ssion | |
688 | * obj ects. | |
689 | * (Ob ject manag ement) | |
690 | * | |
691 | * @pa ram hSessi on the ses sion's han dle | |
692 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
693 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
694 | * @pr econdition s | |
695 | * @po stconditio ns | |
696 | */ | |
697 | public native vo id C_FindO bjectsFina l(long hSe ssion) thr ows PKCS11 Exception; | |
698 | ||
699 | ||
700 | ||
701 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
702 | * Encrypt ion and de cryption | |
703 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
704 | ||
705 | /** | |
706 | * C_E ncryptInit initializ es an encr yption ope ration. | |
707 | * (En cryption a nd decrypt ion) | |
708 | * | |
709 | * @pa ram hSessi on the ses sion's han dle | |
710 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
711 | * @pa ram pMecha nism the e ncryption mechanism | |
712 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
713 | * @pa ram hKey t he handle of the enc ryption ke y | |
714 | * (PKCS #11 param: CK_OBJECT _HANDLE hK ey) | |
715 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
716 | * @pr econdition s | |
717 | * @po stconditio ns | |
718 | */ | |
719 | public native vo id C_Encry ptInit(lon g hSession , CK_MECHA NISM pMech anism, | |
720 | long hKe y) throws PKCS11Exce ption; | |
721 | ||
722 | ||
723 | /** | |
724 | * C_E ncrypt enc rypts sing le-part da ta. | |
725 | * (En cryption a nd decrypt ion) | |
726 | * | |
727 | * @pa ram hSessi on the ses sion's han dle | |
728 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
729 | * @pa ram pData the data t o get encr ypted and the data's length | |
730 | * (PKCS #11 param: CK_BYTE_P TR pData, CK_ULONG u lDataLen) | |
731 | * @re turn the e ncrypted d ata and th e encrypte d data's l ength | |
732 | * (PKCS #11 param: CK_BYTE_P TR pEncryp tedData, | |
733 | * CK_ULONG_ PTR pulEnc ryptedData Len) | |
734 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
735 | * @pr econdition s (pData < > null) | |
736 | * @po stconditio ns (result <> null) | |
737 | */ | |
738 | public native in t C_Encryp t(long hSe ssion, byt e[] in, in t inOfs, i nt inLen, | |
739 | byte[] o ut, int ou tOfs, int outLen) th rows PKCS1 1Exception ; | |
740 | ||
741 | ||
742 | /** | |
743 | * C_E ncryptUpda te continu es a multi ple-part e ncryption | |
744 | * ope ration. | |
745 | * (En cryption a nd decrypt ion) | |
746 | * | |
747 | * @pa ram hSessi on the ses sion's han dle | |
748 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
749 | * @pa ram pPart the data p art to get encrypted and the d ata part's length | |
750 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG u lPartLen) | |
751 | * @re turn the e ncrypted d ata part a nd the enc rypted dat a part's l ength | |
752 | * (PKCS #11 param: CK_BYTE_P TR pEncryp tedPart, | |
753 | C K_ULONG_PT R pulEncry ptedPartLe n) | |
754 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
755 | * @pr econdition s (pPart < > null) | |
756 | * @po stconditio ns | |
757 | */ | |
758 | public native in t C_Encryp tUpdate(lo ng hSessio n, long di rectIn, by te[] in, | |
759 | int inOf s, int inL en, long d irectOut, byte[] out , int outO fs, | |
760 | int outL en) throws PKCS11Exc eption; | |
761 | ||
762 | ||
763 | /** | |
764 | * C_E ncryptFina l finishes a multipl e-part enc ryption | |
765 | * ope ration. | |
766 | * (En cryption a nd decrypt ion) | |
767 | * | |
768 | * @pa ram hSessi on the ses sion's han dle | |
769 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
770 | * @re turn the l ast encryp ted data p art and th e last dat a part's l ength | |
771 | * (PKCS #11 param: CK_BYTE_P TR pLastEn cryptedPar t, | |
772 | C K_ULONG_PT R pulLastE ncryptedPa rtLen) | |
773 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
774 | * @pr econdition s | |
775 | * @po stconditio ns (result <> null) | |
776 | */ | |
777 | public native in t C_Encryp tFinal(lon g hSession , long dir ectOut, by te[] out, | |
778 | int outO fs, int ou tLen) thro ws PKCS11E xception; | |
779 | ||
780 | ||
781 | /** | |
782 | * C_D ecryptInit initializ es a decry ption oper ation. | |
783 | * (En cryption a nd decrypt ion) | |
784 | * | |
785 | * @pa ram hSessi on the ses sion's han dle | |
786 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
787 | * @pa ram pMecha nism the d ecryption mechanism | |
788 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
789 | * @pa ram hKey t he handle of the dec ryption ke y | |
790 | * (PKCS #11 param: CK_OBJECT _HANDLE hK ey) | |
791 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
792 | * @pr econdition s | |
793 | * @po stconditio ns | |
794 | */ | |
795 | public native vo id C_Decry ptInit(lon g hSession , CK_MECHA NISM pMech anism, | |
796 | long hKe y) throws PKCS11Exce ption; | |
797 | ||
798 | ||
799 | /** | |
800 | * C_D ecrypt dec rypts encr ypted data in a sing le part. | |
801 | * (En cryption a nd decrypt ion) | |
802 | * | |
803 | * @pa ram hSessi on the ses sion's han dle | |
804 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
805 | * @pa ram pEncry ptedData t he encrypt ed data to get decry pted and t he | |
806 | * encry pted data' s length | |
807 | * (PKCS #11 param: CK_BYTE_P TR pEncryp tedData, | |
808 | * CK_ULONG ulEncrypte dDataLen) | |
809 | * @re turn the d ecrypted d ata and th e data's l ength | |
810 | * (PKCS #11 param: CK_BYTE_P TR pData, CK_ULONG_P TR pulData Len) | |
811 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
812 | * @pr econdition s (pEncryp tedPart <> null) | |
813 | * @po stconditio ns (result <> null) | |
814 | */ | |
815 | public native in t C_Decryp t(long hSe ssion, byt e[] in, in t inOfs, i nt inLen, | |
816 | byte[] o ut, int ou tOfs, int outLen) th rows PKCS1 1Exception ; | |
817 | ||
818 | ||
819 | /** | |
820 | * C_D ecryptUpda te continu es a multi ple-part d ecryption | |
821 | * ope ration. | |
822 | * (En cryption a nd decrypt ion) | |
823 | * | |
824 | * @pa ram hSessi on the ses sion's han dle | |
825 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
826 | * @pa ram pEncry ptedPart t he encrypt ed data pa rt to get decrypted and the | |
827 | * encry pted data part's len gth | |
828 | * (PKCS #11 param: CK_BYTE_P TR pEncryp tedPart, | |
829 | * CK_ULONG ulEncrypte dPartLen) | |
830 | * @re turn the d ecrypted d ata part a nd the dat a part's l ength | |
831 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG_P TR pulPart Len) | |
832 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
833 | * @pr econdition s (pEncryp tedPart <> null) | |
834 | * @po stconditio ns | |
835 | */ | |
836 | public native in t C_Decryp tUpdate(lo ng hSessio n, long di rectIn, by te[] in, | |
837 | int inOf s, int inL en, long d irectOut, byte[] out , int outO fs, | |
838 | int outL en) throws PKCS11Exc eption; | |
839 | ||
840 | ||
841 | /** | |
842 | * C_D ecryptFina l finishes a multipl e-part dec ryption | |
843 | * ope ration. | |
844 | * (En cryption a nd decrypt ion) | |
845 | * | |
846 | * @pa ram hSessi on the ses sion's han dle | |
847 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
848 | * @re turn the l ast decryp ted data p art and th e last dat a part's l ength | |
849 | * (PKCS #11 param: CK_BYTE_P TR pLastPa rt, | |
850 | * CK_ULONG_ PTR pulLas tPartLen) | |
851 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
852 | * @pr econdition s | |
853 | * @po stconditio ns (result <> null) | |
854 | */ | |
855 | public native in t C_Decryp tFinal(lon g hSession , long dir ectOut, by te[] out, | |
856 | int outO fs, int ou tLen) thro ws PKCS11E xception; | |
857 | ||
858 | ||
859 | ||
860 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
861 | * Message digesting | |
862 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
863 | ||
864 | /** | |
865 | * C_D igestInit initialize s a messag e-digestin g operatio n. | |
866 | * (Me ssage dige sting) | |
867 | * | |
868 | * @pa ram hSessi on the ses sion's han dle | |
869 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
870 | * @pa ram pMecha nism the d igesting m echanism | |
871 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
872 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
873 | * @pr econdition s | |
874 | * @po stconditio ns | |
875 | */ | |
876 | public native vo id C_Diges tInit(long hSession, CK_MECHAN ISM pMecha nism) | |
877 | throws P KCS11Excep tion; | |
878 | ||
879 | ||
880 | // not e that C_D igestSingl e does not exist in PKCS#11 | |
881 | // we combined t he C_Diges tInit and C_Digest i nto a sing le functio n | |
882 | // to save on Ja va<->C tra nsitions a nd save 5- 10% on sma ll digests | |
883 | // thi s made the C_Digest method red undant, it has been removed | |
884 | /** | |
885 | * C_D igest dige sts data i n a single part. | |
886 | * (Me ssage dige sting) | |
887 | * | |
888 | * @pa ram hSessi on the ses sion's han dle | |
889 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
890 | * @pa ram data t he data to get diges ted and th e data's l ength | |
891 | * (PKCS #11 param: CK_BYTE_P TR pData, CK_ULONG u lDataLen) | |
892 | * @re turn the m essage dig est and th e length o f the mess age digest | |
893 | * (PKCS #11 param: CK_BYTE_P TR pDigest , CK_ULONG _PTR pulDi gestLen) | |
894 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
895 | * @pr econdition s (data <> null) | |
896 | * @po stconditio ns (result <> null) | |
897 | */ | |
898 | public native in t C_Digest Single(lon g hSession , CK_MECHA NISM pMech anism, | |
899 | byte[] i n, int inO fs, int in Len, byte[ ] digest, int digest Ofs, | |
900 | int dige stLen) thr ows PKCS11 Exception; | |
901 | ||
902 | ||
903 | /** | |
904 | * C_D igestUpdat e continue s a multip le-part me ssage-dige sting | |
905 | * ope ration. | |
906 | * (Me ssage dige sting) | |
907 | * | |
908 | * @pa ram hSessi on the ses sion's han dle | |
909 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
910 | * @pa ram pPart the data t o get dige sted and t he data's length | |
911 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG u lPartLen) | |
912 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
913 | * @pr econdition s (pPart < > null) | |
914 | * @po stconditio ns | |
915 | */ | |
916 | public native vo id C_Diges tUpdate(lo ng hSessio n, long di rectIn, by te[] in, | |
917 | int inOf s, int inL en) throws PKCS11Exc eption; | |
918 | ||
919 | ||
920 | /** | |
921 | * C_D igestKey c ontinues a multi-par t message- digesting | |
922 | * operatio n, by dige sting the value of a PW key as par t of | |
923 | * the data alre ady digest ed. | |
924 | * (Me ssage dige sting) | |
925 | * | |
926 | * @pa ram hSessi on the ses sion's han dle | |
927 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
928 | * @param h Key the ha ndle of th e PW key to be digested | |
929 | * (PKCS #11 param: CK_OBJECT _HANDLE hK ey) | |
930 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
931 | * @pr econdition s | |
932 | * @po stconditio ns | |
933 | */ | |
934 | public native vo id C_Diges tKey(long hSession, long hKey) | |
935 | throws P KCS11Excep tion; | |
936 | ||
937 | ||
938 | /** | |
939 | * C_D igestFinal finishes a multiple -part mess age-digest ing | |
940 | * ope ration. | |
941 | * (Me ssage dige sting) | |
942 | * | |
943 | * @pa ram hSessi on the ses sion's han dle | |
944 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
945 | * @re turn the m essage dig est and th e length o f the mess age digest | |
946 | * (PKCS #11 param: CK_BYTE_P TR pDigest , CK_ULONG _PTR pulDi gestLen) | |
947 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
948 | * @pr econdition s | |
949 | * @po stconditio ns (result <> null) | |
950 | */ | |
951 | public native in t C_Digest Final(long hSession, byte[] pD igest, int digestOfs , | |
952 | int dige stLen) thr ows PKCS11 Exception; | |
953 | ||
954 | ||
955 | ||
956 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
957 | * Signing and MACin g | |
958 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
959 | ||
960 | /** | |
961 | * C_S ignInit in itializes a signatur e (private key encry ption) | |
962 | * ope ration, wh ere the si gnature is (will be) an append ix to | |
963 | * the data, and plaintext cannot be recovered from the | |
964 | * sig nature. | |
965 | * (Si gning and MACing) | |
966 | * | |
967 | * @pa ram hSessi on the ses sion's han dle | |
968 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
969 | * @pa ram pMecha nism the s ignature m echanism | |
970 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
971 | * @pa ram hKey t he handle of the sig nature key | |
972 | * (PKCS #11 param: CK_OBJECT _HANDLE hK ey) | |
973 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
974 | * @pr econdition s | |
975 | * @po stconditio ns | |
976 | */ | |
977 | public native vo id C_SignI nit(long h Session, C K_MECHANIS M pMechani sm, | |
978 | long hKe y) throws PKCS11Exce ption; | |
979 | ||
980 | ||
981 | /** | |
982 | * C_S ign signs (encrypts with priva te key) da ta in a si ngle | |
983 | * par t, where t he signatu re is (wil l be) an a ppendix to the | |
984 | * dat a, and pla intext can not be rec overed fro m the sign ature. | |
985 | * (Si gning and MACing) | |
986 | * | |
987 | * @pa ram hSessi on the ses sion's han dle | |
988 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
989 | * @pa ram pData the data t o sign and the data' s length | |
990 | * (PKCS #11 param: CK_BYTE_P TR pData, CK_ULONG u lDataLen) | |
991 | * @re turn the s ignature a nd the sig nature's l ength | |
992 | * (PKCS #11 param: CK_BYTE_P TR pSignat ure, | |
993 | * CK_ULONG_ PTR pulSig natureLen) | |
994 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
995 | * @pr econdition s (pData < > null) | |
996 | * @po stconditio ns (result <> null) | |
997 | */ | |
998 | public native by te[] C_Sig n(long hSe ssion, byt e[] pData) | |
999 | throws P KCS11Excep tion; | |
1000 | ||
1001 | ||
1002 | /** | |
1003 | * C_S ignUpdate continues a multiple -part sign ature oper ation, | |
1004 | * whe re the sig nature is (will be) an appendi x to the d ata, | |
1005 | * and plaintext cannot be recovered from the signature. | |
1006 | * (Si gning and MACing) | |
1007 | * | |
1008 | * @pa ram hSessi on the ses sion's han dle | |
1009 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1010 | * @pa ram pPart the data p art to sig n and the data part' s length | |
1011 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG u lPartLen) | |
1012 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1013 | * @pr econdition s (pPart < > null) | |
1014 | * @po stconditio ns | |
1015 | */ | |
1016 | public native vo id C_SignU pdate(long hSession, long dire ctIn, byte [] in, | |
1017 | int inOf s, int inL en) throws PKCS11Exc eption; | |
1018 | ||
1019 | ||
1020 | /** | |
1021 | * C_S ignFinal f inishes a multiple-p art signat ure operat ion, | |
1022 | * ret urning the signature . | |
1023 | * (Si gning and MACing) | |
1024 | * | |
1025 | * @pa ram hSessi on the ses sion's han dle | |
1026 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1027 | * @re turn the s ignature a nd the sig nature's l ength | |
1028 | * (PKCS #11 param: CK_BYTE_P TR pSignat ure, | |
1029 | * CK_ULONG_ PTR pulSig natureLen) | |
1030 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1031 | * @pr econdition s | |
1032 | * @po stconditio ns (result <> null) | |
1033 | */ | |
1034 | public native by te[] C_Sig nFinal(lon g hSession , int expe ctedLen) | |
1035 | throws P KCS11Excep tion; | |
1036 | ||
1037 | ||
1038 | /** | |
1039 | * C_S ignRecover Init initi alizes a s ignature o peration, where | |
1040 | * the data can be recover ed from th e signatur e. | |
1041 | * (Si gning and MACing) | |
1042 | * | |
1043 | * @pa ram hSessi on the ses sion's han dle | |
1044 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1045 | * @pa ram pMecha nism the s ignature m echanism | |
1046 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
1047 | * @pa ram hKey t he handle of the sig nature key | |
1048 | * (PKCS #11 param: CK_OBJECT _HANDLE hK ey) | |
1049 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1050 | * @pr econdition s | |
1051 | * @po stconditio ns | |
1052 | */ | |
1053 | public native vo id C_SignR ecoverInit (long hSes sion, CK_M ECHANISM p Mechanism, | |
1054 | long hKe y) throws PKCS11Exce ption; | |
1055 | ||
1056 | ||
1057 | /** | |
1058 | * C_S ignRecover signs dat a in a sin gle operat ion, where the | |
1059 | * dat a can be r ecovered f rom the si gnature. | |
1060 | * (Si gning and MACing) | |
1061 | * | |
1062 | * @pa ram hSessi on the ses sion's han dle | |
1063 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1064 | * @pa ram pData the data t o sign and the data' s length | |
1065 | * (PKCS #11 param: CK_BYTE_P TR pData, CK_ULONG u lDataLen) | |
1066 | * @re turn the s ignature a nd the sig nature's l ength | |
1067 | * (PKCS #11 param: CK_BYTE_P TR pSignat ure, | |
1068 | * CK_ULONG_ PTR pulSig natureLen) | |
1069 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1070 | * @pr econdition s (pData < > null) | |
1071 | * @po stconditio ns (result <> null) | |
1072 | */ | |
1073 | public native in t C_SignRe cover(long hSession, byte[] in , int inOf s, | |
1074 | int inLe n, byte[] out, int o utOufs, in t outLen) | |
1075 | throws P KCS11Excep tion; | |
1076 | ||
1077 | ||
1078 | ||
1079 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
1080 | * Verifyi ng signatu res and MA Cs | |
1081 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
1082 | ||
1083 | /** | |
1084 | * C_V erifyInit initialize s a verifi cation ope ration, wh ere the | |
1085 | * sig nature is an appendi x to the d ata, and p laintext c annot | |
1086 | * can not be rec overed fro m the sign ature (e.g . DSA). | |
1087 | * (Si gning and MACing) | |
1088 | * | |
1089 | * @pa ram hSessi on the ses sion's han dle | |
1090 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1091 | * @pa ram pMecha nism the v erificatio n mechanis m | |
1092 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
1093 | * @pa ram hKey t he handle of the ver ification key | |
1094 | * (PKCS #11 param: CK_OBJECT _HANDLE hK ey) | |
1095 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1096 | * @pr econdition s | |
1097 | * @po stconditio ns | |
1098 | */ | |
1099 | public native vo id C_Verif yInit(long hSession, CK_MECHAN ISM pMecha nism, | |
1100 | long hKe y) throws PKCS11Exce ption; | |
1101 | ||
1102 | ||
1103 | /** | |
1104 | * C_V erify veri fies a sig nature in a single-p art operat ion, | |
1105 | * whe re the sig nature is an appendi x to the d ata, and p laintext | |
1106 | * can not be rec overed fro m the sign ature. | |
1107 | * (Si gning and MACing) | |
1108 | * | |
1109 | * @pa ram hSessi on the ses sion's han dle | |
1110 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1111 | * @pa ram pData the signed data and the signed data's le ngth | |
1112 | * (PKCS #11 param: CK_BYTE_P TR pData, CK_ULONG u lDataLen) | |
1113 | * @pa ram pSigna ture the s ignature t o verify a nd the sig nature's l ength | |
1114 | * (PKCS #11 param: CK_BYTE_P TR pSignat ure, CK_UL ONG ulSign atureLen) | |
1115 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1116 | * @pr econdition s (pData < > null) an d (pSignat ure <> nul l) | |
1117 | * @po stconditio ns | |
1118 | */ | |
1119 | public native vo id C_Verif y(long hSe ssion, byt e[] pData, byte[] pS ignature) | |
1120 | throws P KCS11Excep tion; | |
1121 | ||
1122 | ||
1123 | /** | |
1124 | * C_V erifyUpdat e continue s a multip le-part ve rification | |
1125 | * ope ration, wh ere the si gnature is an append ix to the data, | |
1126 | * and plaintext cannot be recovered from the signature. | |
1127 | * (Si gning and MACing) | |
1128 | * | |
1129 | * @pa ram hSessi on the ses sion's han dle | |
1130 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1131 | * @pa ram pPart the signed data part and the s igned data part's le ngth | |
1132 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG u lPartLen) | |
1133 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1134 | * @pr econdition s (pPart < > null) | |
1135 | * @po stconditio ns | |
1136 | */ | |
1137 | public native vo id C_Verif yUpdate(lo ng hSessio n, long di rectIn, by te[] in, | |
1138 | int inOf s, int inL en) throws PKCS11Exc eption; | |
1139 | ||
1140 | ||
1141 | /** | |
1142 | * C_V erifyFinal finishes a multiple -part veri fication | |
1143 | * ope ration, ch ecking the signature . | |
1144 | * (Si gning and MACing) | |
1145 | * | |
1146 | * @pa ram hSessi on the ses sion's han dle | |
1147 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1148 | * @pa ram pSigna ture the s ignature t o verify a nd the sig nature's l ength | |
1149 | * (PKCS #11 param: CK_BYTE_P TR pSignat ure, CK_UL ONG ulSign atureLen) | |
1150 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1151 | * @pr econdition s (pSignat ure <> nul l) | |
1152 | * @po stconditio ns | |
1153 | */ | |
1154 | public native vo id C_Verif yFinal(lon g hSession , byte[] p Signature) | |
1155 | throws P KCS11Excep tion; | |
1156 | ||
1157 | ||
1158 | /** | |
1159 | * C_V erifyRecov erInit ini tializes a signature verificat ion | |
1160 | * ope ration, wh ere the da ta is reco vered from the signa ture. | |
1161 | * (Si gning and MACing) | |
1162 | * | |
1163 | * @pa ram hSessi on the ses sion's han dle | |
1164 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1165 | * @pa ram pMecha nism the v erificatio n mechanis m | |
1166 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
1167 | * @pa ram hKey t he handle of the ver ification key | |
1168 | * (PKCS #11 param: CK_OBJECT _HANDLE hK ey) | |
1169 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1170 | * @pr econdition s | |
1171 | * @po stconditio ns | |
1172 | */ | |
1173 | public native vo id C_Verif yRecoverIn it(long hS ession, | |
1174 | CK_MECHA NISM pMech anism, lon g hKey) th rows PKCS1 1Exception ; | |
1175 | ||
1176 | ||
1177 | /** | |
1178 | * C_V erifyRecov er verifie s a signat ure in a s ingle-part | |
1179 | * ope ration, wh ere the da ta is reco vered from the signa ture. | |
1180 | * (Si gning and MACing) | |
1181 | * | |
1182 | * @pa ram hSessi on the ses sion's han dle | |
1183 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1184 | * @pa ram pSigna ture the s ignature t o verify a nd the sig nature's l ength | |
1185 | * (PKCS #11 param: CK_BYTE_P TR pSignat ure, CK_UL ONG ulSign atureLen) | |
1186 | * @re turn the r ecovered d ata and th e recovere d data's l ength | |
1187 | * (PKCS #11 param: CK_BYTE_P TR pData, CK_ULONG_P TR pulData Len) | |
1188 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1189 | * @pr econdition s (pSignat ure <> nul l) | |
1190 | * @po stconditio ns (result <> null) | |
1191 | */ | |
1192 | public native in t C_Verify Recover(lo ng hSessio n, byte[] in, int in Ofs, | |
1193 | int inLe n, byte[] out, int o utOufs, in t outLen) | |
1194 | throws P KCS11Excep tion; | |
1195 | ||
1196 | ||
1197 | ||
1198 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
1199 | * Dual-fu nction cry ptographic operation s | |
1200 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
1201 | ||
1202 | /** | |
1203 | * C_D igestEncry ptUpdate c ontinues a multiple- part diges ting | |
1204 | * and encryptio n operatio n. | |
1205 | * (Du al-functio n cryptogr aphic oper ations) | |
1206 | * | |
1207 | * @pa ram hSessi on the ses sion's han dle | |
1208 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1209 | * @pa ram pPart the data p art to dig est and to encrypt a nd the dat a's length | |
1210 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG u lPartLen) | |
1211 | * @re turn the d igested an d encrypte d data par t and the data part' s length | |
1212 | * (PKCS #11 param: CK_BYTE_P TR pEncryp tedPart, | |
1213 | * CK_ULONG_ PTR pulEnc ryptedPart Len) | |
1214 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1215 | * @pr econdition s (pPart < > null) | |
1216 | * @po stconditio ns | |
1217 | */ | |
1218 | // publ ic native byte[] C_D igestEncry ptUpdate(l ong hSessi on, byte[] pPart) | |
1219 | // throws PKCS11Exc eption; | |
1220 | ||
1221 | ||
1222 | /** | |
1223 | * C_D ecryptDige stUpdate c ontinues a multiple- part decry ption and | |
1224 | * dig esting ope ration. | |
1225 | * (Du al-functio n cryptogr aphic oper ations) | |
1226 | * | |
1227 | * @pa ram hSessi on the ses sion's han dle | |
1228 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1229 | * @pa ram pEncry ptedPart t he encrypt ed data pa rt to decr ypt and to digest | |
1230 | * and e ncrypted d ata part's length | |
1231 | * (PKCS #11 param: CK_BYTE_P TR pEncryp tedPart, | |
1232 | * CK_ULONG ulEncrypte dPartLen) | |
1233 | * @re turn the d ecrypted a nd digeste d data par t and the data part' s length | |
1234 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG_P TR pulPart Len) | |
1235 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1236 | * @pr econdition s (pEncryp tedPart <> null) | |
1237 | * @po stconditio ns | |
1238 | */ | |
1239 | // publ ic native byte[] C_D ecryptDige stUpdate(l ong hSessi on, | |
1240 | // byte[] pEncrypte dPart) thr ows PKCS11 Exception; | |
1241 | ||
1242 | ||
1243 | /** | |
1244 | * C_S ignEncrypt Update con tinues a m ultiple-pa rt signing and | |
1245 | * enc ryption op eration. | |
1246 | * (Du al-functio n cryptogr aphic oper ations) | |
1247 | * | |
1248 | * @pa ram hSessi on the ses sion's han dle | |
1249 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1250 | * @pa ram pPart the data p art to sig n and to e ncrypt and the data part's | |
1251 | * lengt h | |
1252 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG u lPartLen) | |
1253 | * @re turn the s igned and encrypted data part and the da ta part's length | |
1254 | * (PKCS #11 param: CK_BYTE_P TR pEncryp tedPart, | |
1255 | * CK_ULONG_ PTR pulEnc ryptedPart Len) | |
1256 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1257 | * @pr econdition s (pPart < > null) | |
1258 | * @po stconditio ns | |
1259 | */ | |
1260 | // publ ic native byte[] C_S ignEncrypt Update(lon g hSession , byte[] p Part) | |
1261 | // throws PKCS11Exc eption; | |
1262 | ||
1263 | ||
1264 | /** | |
1265 | * C_D ecryptVeri fyUpdate c ontinues a multiple- part decry ption and | |
1266 | * ver ify operat ion. | |
1267 | * (Du al-functio n cryptogr aphic oper ations) | |
1268 | * | |
1269 | * @pa ram hSessi on the ses sion's han dle | |
1270 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1271 | * @pa ram pEncry ptedPart t he encrypt ed data pa rt to decr ypt and to verify | |
1272 | * and t he data pa rt's lengt h | |
1273 | * (PKCS #11 param: CK_BYTE_P TR pEncryp tedPart, | |
1274 | * CK_ULONG ulEncrypte dPartLen) | |
1275 | * @re turn the d ecrypted a nd verifie d data par t and the data part' s length | |
1276 | * (PKCS #11 param: CK_BYTE_P TR pPart, CK_ULONG_P TR pulPart Len) | |
1277 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1278 | * @pr econdition s (pEncryp tedPart <> null) | |
1279 | * @po stconditio ns | |
1280 | */ | |
1281 | // publ ic native byte[] C_D ecryptVeri fyUpdate(l ong hSessi on, | |
1282 | // byte[] pEncrypte dPart) thr ows PKCS11 Exception; | |
1283 | ||
1284 | ||
1285 | ||
1286 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
1287 | * Key man agement | |
1288 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
1289 | ||
1290 | /** | |
1291 | * C_Genera teKey gene rates a PW key, creat ing a new key | |
1292 | * obj ect. | |
1293 | * (Ke y manageme nt) | |
1294 | * | |
1295 | * @pa ram hSessi on the ses sion's han dle | |
1296 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1297 | * @pa ram pMecha nism the k ey generat ion mechan ism | |
1298 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
1299 | * @pa ram pTempl ate the te mplate for the new k ey and the number of | |
1300 | * attri butes in t he templat e | |
1301 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pT emplate, C K_ULONG ul Count) | |
1302 | * @re turn the h andle of t he new key | |
1303 | * (PKCS #11 param: CK_OBJECT _HANDLE_PT R phKey) | |
1304 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1305 | * @pr econdition s | |
1306 | * @po stconditio ns | |
1307 | */ | |
1308 | public native lo ng C_Gener ateKey(lon g hSession , CK_MECHA NISM pMech anism, | |
1309 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception ; | |
1310 | ||
1311 | ||
1312 | /** | |
1313 | * C_G enerateKey Pair gener ates a pub lic-key/pr ivate-key pair, | |
1314 | * cre ating new key object s. | |
1315 | * (Ke y manageme nt) | |
1316 | * | |
1317 | * @pa ram hSessi on the ses sion's han dle | |
1318 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1319 | * @pa ram pMecha nism the k ey generat ion mechan ism | |
1320 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
1321 | * @pa ram pPubli cKeyTempla te the tem plate for the new pu blic key a nd the | |
1322 | * numbe r of attri butes in t he templat e | |
1323 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pP ublicKeyTe mplate, | |
1324 | * CK_ULONG ulPublicKe yAttribute Count) | |
1325 | * @pa ram pPriva teKeyTempl ate the te mplate for the new p rivate key and the | |
1326 | * numbe r of attri butes in t he templat e | |
1327 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pP rivateKeyT emplate | |
1328 | * CK_ULONG ulPrivateK eyAttribut eCount) | |
1329 | * @re turn a lon g array wi th exactly two eleme nts and th e public k ey handle | |
1330 | * as th e first el ement and the privat e key hand le as the second | |
1331 | * eleme nt | |
1332 | * (PKCS #11 param: CK_OBJECT _HANDLE_PT R phPublic Key, | |
1333 | * CK_OBJECT _HANDLE_PT R phPrivat eKey) | |
1334 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1335 | * @pr econdition s (pMechan ism <> nul l) | |
1336 | * @po stconditio ns (result <> null) and (resul t.length = = 2) | |
1337 | */ | |
1338 | public native lo ng[] C_Gen erateKeyPa ir(long hS ession, | |
1339 | CK_MECHA NISM pMech anism, CK_ ATTRIBUTE[ ] pPublicK eyTemplate , | |
1340 | CK_ATTRI BUTE[] pPr ivateKeyTe mplate) th rows PKCS1 1Exception ; | |
1341 | ||
1342 | ||
1343 | ||
1344 | /** | |
1345 | * C_W rapKey wra ps (i.e., encrypts) a key. | |
1346 | * (Ke y manageme nt) | |
1347 | * | |
1348 | * @pa ram hSessi on the ses sion's han dle | |
1349 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1350 | * @pa ram pMecha nism the w rapping me chanism | |
1351 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
1352 | * @pa ram hWrapp ingKey the handle of the wrapp ing key | |
1353 | * (PKCS #11 param: CK_OBJECT _HANDLE hW rappingKey ) | |
1354 | * @pa ram hKey t he handle of the key to be wra pped | |
1355 | * (PKCS #11 param: CK_OBJECT _HANDLE hK ey) | |
1356 | * @re turn the w rapped key and the l ength of t he wrapped key | |
1357 | * (PKCS #11 param: CK_BYTE_P TR pWrappe dKey, | |
1358 | * CK_ULONG_ PTR pulWra ppedKeyLen ) | |
1359 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1360 | * @pr econdition s | |
1361 | * @po stconditio ns (result <> null) | |
1362 | */ | |
1363 | public native by te[] C_Wra pKey(long hSession, CK_MECHANI SM pMechan ism, | |
1364 | long hWr appingKey, long hKey ) throws P KCS11Excep tion; | |
1365 | ||
1366 | ||
1367 | /** | |
1368 | * C_U nwrapKey u nwraps (de crypts) a wrapped ke y, creatin g a new | |
1369 | * key object. | |
1370 | * (Ke y manageme nt) | |
1371 | * | |
1372 | * @pa ram hSessi on the ses sion's han dle | |
1373 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1374 | * @pa ram pMecha nism the u nwrapping mechanism | |
1375 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
1376 | * @pa ram hUnwra ppingKey t he handle of the unw rapping ke y | |
1377 | * (PKCS #11 param: CK_OBJECT _HANDLE hU nwrappingK ey) | |
1378 | * @pa ram pWrapp edKey the wrapped ke y to unwra p and the wrapped ke y's length | |
1379 | * (PKCS #11 param: CK_BYTE_P TR pWrappe dKey, CK_U LONG ulWra ppedKeyLen ) | |
1380 | * @pa ram pTempl ate the te mplate for the new k ey and the number of | |
1381 | * attri butes in t he templat e | |
1382 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pT emplate, C K_ULONG ul Count) | |
1383 | * @re turn the h andle of t he unwrapp ed key | |
1384 | * (PKCS #11 param: CK_OBJECT _HANDLE_PT R phKey) | |
1385 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1386 | * @pr econdition s (pWrappe dKey <> nu ll) | |
1387 | * @po stconditio ns | |
1388 | */ | |
1389 | public native lo ng C_Unwra pKey(long hSession, CK_MECHANI SM pMechan ism, | |
1390 | long hUn wrappingKe y, byte[] pWrappedKe y, CK_ATTR IBUTE[] pT emplate) | |
1391 | throws P KCS11Excep tion; | |
1392 | ||
1393 | ||
1394 | /** | |
1395 | * C_D eriveKey d erives a k ey from a base key, creating a new key | |
1396 | * obj ect. | |
1397 | * (Ke y manageme nt) | |
1398 | * | |
1399 | * @pa ram hSessi on the ses sion's han dle | |
1400 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1401 | * @pa ram pMecha nism the k ey derivat ion mechan ism | |
1402 | * (PKCS #11 param: CK_MECHAN ISM_PTR pM echanism) | |
1403 | * @pa ram hBaseK ey the han dle of the base key | |
1404 | * (PKCS #11 param: CK_OBJECT _HANDLE hB aseKey) | |
1405 | * @pa ram pTempl ate the te mplate for the new k ey and the number of | |
1406 | * attri butes in t he templat e | |
1407 | * (PKCS #11 param: CK_ATTRIB UTE_PTR pT emplate, C K_ULONG ul Count) | |
1408 | * @re turn the h andle of t he derived key | |
1409 | * (PKCS #11 param: CK_OBJECT _HANDLE_PT R phKey) | |
1410 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1411 | * @pr econdition s | |
1412 | * @po stconditio ns | |
1413 | */ | |
1414 | public native lo ng C_Deriv eKey(long hSession, CK_MECHANI SM pMechan ism, | |
1415 | long hBa seKey, CK_ ATTRIBUTE[ ] pTemplat e) throws PKCS11Exce ption; | |
1416 | ||
1417 | ||
1418 | ||
1419 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
1420 | * Random number gen eration | |
1421 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
1422 | ||
1423 | /** | |
1424 | * C_S eedRandom mixes addi tional see d material into the token's | |
1425 | * ran dom number generator . | |
1426 | * (Ra ndom numbe r generati on) | |
1427 | * | |
1428 | * @pa ram hSessi on the ses sion's han dle | |
1429 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1430 | * @pa ram pSeed the seed m aterial an d the seed material' s length | |
1431 | * (PKCS #11 param: CK_BYTE_P TR pSeed, CK_ULONG u lSeedLen) | |
1432 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1433 | * @pr econdition s (pSeed < > null) | |
1434 | * @po stconditio ns | |
1435 | */ | |
1436 | public native vo id C_SeedR andom(long hSession, byte[] pS eed) | |
1437 | throws P KCS11Excep tion; | |
1438 | ||
1439 | ||
1440 | /** | |
1441 | * C_G enerateRan dom genera tes random data. | |
1442 | * (Ra ndom numbe r generati on) | |
1443 | * | |
1444 | * @pa ram hSessi on the ses sion's han dle | |
1445 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1446 | * @pa ram Random Data recei ves the ra ndom data and the le ngth of Ra ndomData | |
1447 | * is th e length o f random d ata to be generated | |
1448 | * (PKCS #11 param: CK_BYTE_P TR pRandom Data, CK_U LONG ulRan domLen) | |
1449 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1450 | * @pr econdition s (randomD ata <> nul l) | |
1451 | * @po stconditio ns | |
1452 | */ | |
1453 | public native vo id C_Gener ateRandom( long hSess ion, byte[ ] randomDa ta) | |
1454 | throws P KCS11Excep tion; | |
1455 | ||
1456 | ||
1457 | ||
1458 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
1459 | * Paralle l function managemen t | |
1460 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
1461 | ||
1462 | /** | |
1463 | * C_G etFunction Status is a legacy f unction; i t obtains an | |
1464 | * upd ated statu s of a fun ction runn ing in par allel with an | |
1465 | * app lication. | |
1466 | * (Pa rallel fun ction mana gement) | |
1467 | * | |
1468 | * @pa ram hSessi on the ses sion's han dle | |
1469 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1470 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1471 | * @pr econdition s | |
1472 | * @po stconditio ns | |
1473 | */ | |
1474 | // publ ic native void C_Get FunctionSt atus(long hSession) | |
1475 | // throws PKCS11Exc eption; | |
1476 | ||
1477 | ||
1478 | /** | |
1479 | * C_C ancelFunct ion is a l egacy func tion; it c ancels a f unction | |
1480 | * run ning in pa rallel. | |
1481 | * (Pa rallel fun ction mana gement) | |
1482 | * | |
1483 | * @pa ram hSessi on the ses sion's han dle | |
1484 | * (PKCS #11 param: CK_SESSIO N_HANDLE h Session) | |
1485 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1486 | * @pr econdition s | |
1487 | * @po stconditio ns | |
1488 | */ | |
1489 | // publ ic native void C_Can celFunctio n(long hSe ssion) thr ows PKCS11 Exception; | |
1490 | ||
1491 | ||
1492 | ||
1493 | /* ******* ********** ********** ********** ********** ********** ********** ********** | |
1494 | * Functio ns added i n for Cryp toki Versi on 2.01 or later | |
1495 | ********* ********** ********** ********** ********** ********** ********** *********/ | |
1496 | ||
1497 | /** | |
1498 | * C_W aitForSlot Event wait s for a sl ot event ( token inse rtion, | |
1499 | * rem oval, etc. ) to occur . | |
1500 | * (Ge neral-purp ose) | |
1501 | * | |
1502 | * @pa ram flags blocking/n onblocking flag | |
1503 | * (PKCS #11 param: CK_FLAGS flags) | |
1504 | * @pa ram pReser ved reserv ed. Should be null | |
1505 | * (PKCS #11 param: CK_VOID_P TR pReserv ed) | |
1506 | * @re turn the s lot ID whe re the eve nt occurre d | |
1507 | * (PKCS #11 param: CK_SLOT_I D_PTR pSlo t) | |
1508 | * @ex ception PK CS11Except ion If fun ction retu rns other value than CKR_OK. | |
1509 | * @pr econdition s (pRserve d == null) | |
1510 | * @po stconditio ns | |
1511 | */ | |
1512 | // publ ic native long C_Wai tForSlotEv ent(long f lags, Obje ct pRserve d) | |
1513 | // throws PKCS11Exc eption; | |
1514 | ||
1515 | /** | |
1516 | * Ret urns the s tring repr esentation of this o bject. | |
1517 | * | |
1518 | * @re turn The s tring repr esentation of object | |
1519 | */ | |
1520 | public String to String() { | |
1521 | re turn "Modu le name: " + pkcs11M odulePath; | |
1522 | } | |
1523 | ||
1524 | /** | |
1525 | * Cal ls disconn ect() to c leanup the native pa rt of the wrapper. O nce this | |
1526 | * met hod is cal led, this object can not be use d any long er. Any su bsequent | |
1527 | * cal l to a C_* method wi ll result in a runti me excepti on. | |
1528 | * | |
1529 | * @ex ception Th rowable If finalizat ion fails. | |
1530 | */ | |
1531 | protec ted void f inalize() throws Thr owable { | |
1532 | di sconnect() ; | |
1533 | } | |
1534 | ||
1535 | // PKCS11 subclass t hat has al l methods synchroniz ed and del egating to the | |
1536 | // parent. Used for tokens tha t only sup port singl e threaded access | |
1537 | static cla ss Synchro nizedPKCS1 1 extends PKCS11 { | |
1538 | ||
1539 | Synchr onizedPKCS 11(String pkcs11Modu lePath, St ring funct ionListNam e) | |
1540 | throws I OException { | |
1541 | su per(pkcs11 ModulePath , function ListName); | |
1542 | } | |
1543 | ||
1544 | synchr onized voi d C_Initia lize(Objec t pInitArg s) throws PKCS11Exce ption { | |
1545 | su per.C_Init ialize(pIn itArgs); | |
1546 | } | |
1547 | ||
1548 | public synchroni zed void C _Finalize( Object pRe served) | |
1549 | throws P KCS11Excep tion { | |
1550 | su per.C_Fina lize(pRese rved); | |
1551 | } | |
1552 | ||
1553 | public synchroni zed CK_INF O C_GetInf o() throws PKCS11Exc eption { | |
1554 | re turn super .C_GetInfo (); | |
1555 | } | |
1556 | ||
1557 | public synchroni zed long[] C_GetSlot List(boole an tokenPr esent) | |
1558 | throws P KCS11Excep tion { | |
1559 | re turn super .C_GetSlot List(token Present); | |
1560 | } | |
1561 | ||
1562 | public synchroni zed CK_SLO T_INFO C_G etSlotInfo (long slot ID) | |
1563 | throws P KCS11Excep tion { | |
1564 | re turn super .C_GetSlot Info(slotI D); | |
1565 | } | |
1566 | ||
1567 | public synchroni zed CK_TOK EN_INFO C_ GetTokenIn fo(long sl otID) | |
1568 | throws P KCS11Excep tion { | |
1569 | re turn super .C_GetToke nInfo(slot ID); | |
1570 | } | |
1571 | ||
1572 | public synchroni zed long[] C_GetMech anismList( long slotI D) | |
1573 | throws P KCS11Excep tion { | |
1574 | re turn super .C_GetMech anismList( slotID); | |
1575 | } | |
1576 | ||
1577 | public synchroni zed CK_MEC HANISM_INF O C_GetMec hanismInfo (long slot ID, | |
1578 | long typ e) throws PKCS11Exce ption { | |
1579 | re turn super .C_GetMech anismInfo( slotID, ty pe); | |
1580 | } | |
1581 | ||
1582 | public synchroni zed long C _OpenSessi on(long sl otID, long flags, | |
1583 | Object p Applicatio n, CK_NOTI FY Notify) throws PK CS11Except ion { | |
1584 | re turn super .C_OpenSes sion(slotI D, flags, pApplicati on, Notify ); | |
1585 | } | |
1586 | ||
1587 | public synchroni zed void C _CloseSess ion(long h Session) | |
1588 | throws P KCS11Excep tion { | |
1589 | su per.C_Clos eSession(h Session); | |
1590 | } | |
1591 | ||
1592 | public synchroni zed CK_SES SION_INFO C_GetSessi onInfo(lon g hSession ) | |
1593 | throws P KCS11Excep tion { | |
1594 | re turn super .C_GetSess ionInfo(hS ession); | |
1595 | } | |
1596 | ||
1597 | public synchroni zed void C _Login(lon g hSession , long use rType, cha r[] pPin) | |
1598 | throws P KCS11Excep tion { | |
1599 | su per.C_Logi n(hSession , userType , pPin); | |
1600 | } | |
1601 | ||
1602 | public synchroni zed void C _Logout(lo ng hSessio n) throws PKCS11Exce ption { | |
1603 | su per.C_Logo ut(hSessio n); | |
1604 | } | |
1605 | ||
1606 | public synchroni zed long C _CreateObj ect(long h Session, | |
1607 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception { | |
1608 | re turn super .C_CreateO bject(hSes sion, pTem plate); | |
1609 | } | |
1610 | ||
1611 | public synchroni zed long C _CopyObjec t(long hSe ssion, lon g hObject, | |
1612 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception { | |
1613 | re turn super .C_CopyObj ect(hSessi on, hObjec t, pTempla te); | |
1614 | } | |
1615 | ||
1616 | public synchroni zed void C _DestroyOb ject(long hSession, long hObje ct) | |
1617 | throws P KCS11Excep tion { | |
1618 | su per.C_Dest royObject( hSession, hObject); | |
1619 | } | |
1620 | ||
1621 | public synchroni zed void C _GetAttrib uteValue(l ong hSessi on, long h Object, | |
1622 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception { | |
1623 | su per.C_GetA ttributeVa lue(hSessi on, hObjec t, pTempla te); | |
1624 | } | |
1625 | ||
1626 | public synchroni zed void C _SetAttrib uteValue(l ong hSessi on, long h Object, | |
1627 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception { | |
1628 | su per.C_SetA ttributeVa lue(hSessi on, hObjec t, pTempla te); | |
1629 | } | |
1630 | ||
1631 | public synchroni zed void C _FindObjec tsInit(lon g hSession , | |
1632 | CK_ATTRI BUTE[] pTe mplate) th rows PKCS1 1Exception { | |
1633 | su per.C_Find ObjectsIni t(hSession , pTemplat e); | |
1634 | } | |
1635 | ||
1636 | public synchroni zed long[] C_FindObj ects(long hSession, | |
1637 | long ulM axObjectCo unt) throw s PKCS11Ex ception { | |
1638 | re turn super .C_FindObj ects(hSess ion, ulMax ObjectCoun t); | |
1639 | } | |
1640 | ||
1641 | public synchroni zed void C _FindObjec tsFinal(lo ng hSessio n) | |
1642 | throws P KCS11Excep tion { | |
1643 | su per.C_Find ObjectsFin al(hSessio n); | |
1644 | } | |
1645 | ||
1646 | public synchroni zed void C _EncryptIn it(long hS ession, | |
1647 | CK_MECHA NISM pMech anism, lon g hKey) th rows PKCS1 1Exception { | |
1648 | su per.C_Encr yptInit(hS ession, pM echanism, hKey); | |
1649 | } | |
1650 | ||
1651 | public synchroni zed int C_ Encrypt(lo ng hSessio n, byte[] in, int in Ofs, | |
1652 | int inLe n, byte[] out, int o utOfs, int outLen) | |
1653 | throws P KCS11Excep tion { | |
1654 | re turn super .C_Encrypt (hSession, in, inOfs , inLen, o ut, outOfs , outLen); | |
1655 | } | |
1656 | ||
1657 | public synchroni zed int C_ EncryptUpd ate(long h Session, l ong direct In, | |
1658 | byte[] i n, int inO fs, int in Len, long directOut, byte[] ou t, | |
1659 | int outO fs, int ou tLen) thro ws PKCS11E xception { | |
1660 | re turn super .C_Encrypt Update(hSe ssion, dir ectIn, in, inOfs, in Len, | |
1661 | dire ctOut, out , outOfs, outLen); | |
1662 | } | |
1663 | ||
1664 | public synchroni zed int C_ EncryptFin al(long hS ession, lo ng directO ut, | |
1665 | byte[] o ut, int ou tOfs, int outLen) th rows PKCS1 1Exception { | |
1666 | re turn super .C_Encrypt Final(hSes sion, dire ctOut, out , outOfs, outLen); | |
1667 | } | |
1668 | ||
1669 | public synchroni zed void C _DecryptIn it(long hS ession, | |
1670 | CK_MECHA NISM pMech anism, lon g hKey) th rows PKCS1 1Exception { | |
1671 | su per.C_Decr yptInit(hS ession, pM echanism, hKey); | |
1672 | } | |
1673 | ||
1674 | public synchroni zed int C_ Decrypt(lo ng hSessio n, byte[] in, int in Ofs, | |
1675 | int inLe n, byte[] out, int o utOfs, int outLen) | |
1676 | throws P KCS11Excep tion { | |
1677 | re turn super .C_Decrypt (hSession, in, inOfs , inLen, o ut, outOfs , outLen); | |
1678 | } | |
1679 | ||
1680 | public synchroni zed int C_ DecryptUpd ate(long h Session, l ong direct In, | |
1681 | byte[] i n, int inO fs, int in Len, long directOut, byte[] ou t, | |
1682 | int outO fs, int ou tLen) thro ws PKCS11E xception { | |
1683 | re turn super .C_Decrypt Update(hSe ssion, dir ectIn, in, inOfs, in Len, | |
1684 | dire ctOut, out , outOfs, outLen); | |
1685 | } | |
1686 | ||
1687 | public synchroni zed int C_ DecryptFin al(long hS ession, lo ng directO ut, | |
1688 | byte[] o ut, int ou tOfs, int outLen) th rows PKCS1 1Exception { | |
1689 | re turn super .C_Decrypt Final(hSes sion, dire ctOut, out , outOfs, outLen); | |
1690 | } | |
1691 | ||
1692 | public synchroni zed void C _DigestIni t(long hSe ssion, CK_ MECHANISM pMechanism ) | |
1693 | throws P KCS11Excep tion { | |
1694 | su per.C_Dige stInit(hSe ssion, pMe chanism); | |
1695 | } | |
1696 | ||
1697 | public synchroni zed int C_ DigestSing le(long hS ession, | |
1698 | CK_MECHA NISM pMech anism, byt e[] in, in t inOfs, i nt inLen, | |
1699 | byte[] d igest, int digestOfs , int dige stLen) thr ows PKCS11 Exception { | |
1700 | re turn super .C_DigestS ingle(hSes sion, pMec hanism, in , inOfs, i nLen, | |
1701 | dige st, digest Ofs, diges tLen); | |
1702 | } | |
1703 | ||
1704 | public synchroni zed void C _DigestUpd ate(long h Session, l ong direct In, | |
1705 | byte[] i n, int inO fs, int in Len) throw s PKCS11Ex ception { | |
1706 | su per.C_Dige stUpdate(h Session, d irectIn, i n, inOfs, inLen); | |
1707 | } | |
1708 | ||
1709 | public synchroni zed void C _DigestKey (long hSes sion, long hKey) | |
1710 | throws P KCS11Excep tion { | |
1711 | su per.C_Dige stKey(hSes sion, hKey ); | |
1712 | } | |
1713 | ||
1714 | public synchroni zed int C_ DigestFina l(long hSe ssion, byt e[] pDiges t, | |
1715 | int dige stOfs, int digestLen ) throws P KCS11Excep tion { | |
1716 | re turn super .C_DigestF inal(hSess ion, pDige st, digest Ofs, diges tLen); | |
1717 | } | |
1718 | ||
1719 | public synchroni zed void C _SignInit( long hSess ion, CK_ME CHANISM pM echanism, | |
1720 | long hKe y) throws PKCS11Exce ption { | |
1721 | su per.C_Sign Init(hSess ion, pMech anism, hKe y); | |
1722 | } | |
1723 | ||
1724 | public synchroni zed byte[] C_Sign(lo ng hSessio n, byte[] pData) | |
1725 | throws P KCS11Excep tion { | |
1726 | re turn super .C_Sign(hS ession, pD ata); | |
1727 | } | |
1728 | ||
1729 | public synchroni zed void C _SignUpdat e(long hSe ssion, lon g directIn , | |
1730 | byte[] i n, int inO fs, int in Len) throw s PKCS11Ex ception { | |
1731 | su per.C_Sign Update(hSe ssion, dir ectIn, in, inOfs, in Len); | |
1732 | } | |
1733 | ||
1734 | public synchroni zed byte[] C_SignFin al(long hS ession, in t expected Len) | |
1735 | throws P KCS11Excep tion { | |
1736 | re turn super .C_SignFin al(hSessio n, expecte dLen); | |
1737 | } | |
1738 | ||
1739 | public synchroni zed void C _SignRecov erInit(lon g hSession , | |
1740 | CK_MECHA NISM pMech anism, lon g hKey) th rows PKCS1 1Exception { | |
1741 | su per.C_Sign RecoverIni t(hSession , pMechani sm, hKey); | |
1742 | } | |
1743 | ||
1744 | public synchroni zed int C_ SignRecove r(long hSe ssion, byt e[] in, in t inOfs, | |
1745 | int inLe n, byte[] out, int o utOufs, in t outLen) | |
1746 | throws P KCS11Excep tion { | |
1747 | re turn super .C_SignRec over(hSess ion, in, i nOfs, inLe n, out, ou tOufs, | |
1748 | outL en); | |
1749 | } | |
1750 | ||
1751 | public synchroni zed void C _VerifyIni t(long hSe ssion, CK_ MECHANISM pMechanism , | |
1752 | long hKe y) throws PKCS11Exce ption { | |
1753 | su per.C_Veri fyInit(hSe ssion, pMe chanism, h Key); | |
1754 | } | |
1755 | ||
1756 | public synchroni zed void C _Verify(lo ng hSessio n, byte[] pData, | |
1757 | byte[] p Signature) throws PK CS11Except ion { | |
1758 | su per.C_Veri fy(hSessio n, pData, pSignature ); | |
1759 | } | |
1760 | ||
1761 | public synchroni zed void C _VerifyUpd ate(long h Session, l ong direct In, | |
1762 | byte[] i n, int inO fs, int in Len) throw s PKCS11Ex ception { | |
1763 | su per.C_Veri fyUpdate(h Session, d irectIn, i n, inOfs, inLen); | |
1764 | } | |
1765 | ||
1766 | public synchroni zed void C _VerifyFin al(long hS ession, by te[] pSign ature) | |
1767 | throws P KCS11Excep tion { | |
1768 | su per.C_Veri fyFinal(hS ession, pS ignature); | |
1769 | } | |
1770 | ||
1771 | public synchroni zed void C _VerifyRec overInit(l ong hSessi on, | |
1772 | CK_MECHA NISM pMech anism, lon g hKey) th rows PKCS1 1Exception { | |
1773 | su per.C_Veri fyRecoverI nit(hSessi on, pMecha nism, hKey ); | |
1774 | } | |
1775 | ||
1776 | public synchroni zed int C_ VerifyReco ver(long h Session, b yte[] in, int inOfs, | |
1777 | int inLe n, byte[] out, int o utOufs, in t outLen) | |
1778 | throws P KCS11Excep tion { | |
1779 | re turn super .C_VerifyR ecover(hSe ssion, in, inOfs, in Len, out, outOufs, | |
1780 | outL en); | |
1781 | } | |
1782 | ||
1783 | public synchroni zed long C _GenerateK ey(long hS ession, | |
1784 | CK_MECHA NISM pMech anism, CK_ ATTRIBUTE[ ] pTemplat e) | |
1785 | throws P KCS11Excep tion { | |
1786 | re turn super .C_Generat eKey(hSess ion, pMech anism, pTe mplate); | |
1787 | } | |
1788 | ||
1789 | public synchroni zed long[] C_Generat eKeyPair(l ong hSessi on, | |
1790 | CK_MECHA NISM pMech anism, CK_ ATTRIBUTE[ ] pPublicK eyTemplate , | |
1791 | CK_ATTRI BUTE[] pPr ivateKeyTe mplate) | |
1792 | throws P KCS11Excep tion { | |
1793 | re turn super .C_Generat eKeyPair(h Session, p Mechanism, pPublicKe yTemplate, | |
1794 | pPri vateKeyTem plate); | |
1795 | } | |
1796 | ||
1797 | public synchroni zed byte[] C_WrapKey (long hSes sion, CK_M ECHANISM p Mechanism, | |
1798 | long hWr appingKey, long hKey ) throws P KCS11Excep tion { | |
1799 | re turn super .C_WrapKey (hSession, pMechanis m, hWrappi ngKey, hKe y); | |
1800 | } | |
1801 | ||
1802 | public synchroni zed long C _UnwrapKey (long hSes sion, CK_M ECHANISM p Mechanism, | |
1803 | long hUn wrappingKe y, byte[] pWrappedKe y, CK_ATTR IBUTE[] pT emplate) | |
1804 | throws P KCS11Excep tion { | |
1805 | re turn super .C_UnwrapK ey(hSessio n, pMechan ism, hUnwr appingKey, | |
1806 | pWra ppedKey, p Template); | |
1807 | } | |
1808 | ||
1809 | public synchroni zed long C _DeriveKey (long hSes sion, CK_M ECHANISM p Mechanism, | |
1810 | long h BaseKey, C K_ATTRIBUT E[] pTempl ate) throw s PKCS11Ex ception { | |
1811 | re turn super .C_DeriveK ey(hSessio n, pMechan ism, hBase Key, pTemp late); | |
1812 | } | |
1813 | ||
1814 | public synchroni zed void C _SeedRando m(long hSe ssion, byt e[] pSeed) | |
1815 | throws P KCS11Excep tion { | |
1816 | su per.C_Seed Random(hSe ssion, pSe ed); | |
1817 | } | |
1818 | ||
1819 | public synchroni zed void C _GenerateR andom(long hSession, byte[] ra ndomData) | |
1820 | throws P KCS11Excep tion { | |
1821 | su per.C_Gene rateRandom (hSession, randomDat a); | |
1822 | } | |
1823 | } | |
1824 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.