changeset 11507 | bd978326a655 |
parent 5506 | 202f599c92aa |
child 12813 | c10ab96dcf41 |
11365:05d995976571 | 11507:bd978326a655 |
---|---|
1 /* |
1 /* |
2 * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. |
3 */ |
3 */ |
4 |
4 |
5 /* Copyright (c) 2002 Graz University of Technology. All rights reserved. |
5 /* Copyright (c) 2002 Graz University of Technology. All rights reserved. |
6 * |
6 * |
7 * Redistribution and use in source and binary forms, with or without |
7 * Redistribution and use in source and binary forms, with or without |
131 * |
131 * |
132 * @param pkcs11ModulePath the PKCS#11 library path |
132 * @param pkcs11ModulePath the PKCS#11 library path |
133 * @preconditions (pkcs11ModulePath <> null) |
133 * @preconditions (pkcs11ModulePath <> null) |
134 * @postconditions |
134 * @postconditions |
135 */ |
135 */ |
136 PKCS11(String pkcs11ModulePath, String functionListName) throws IOException { |
136 PKCS11(String pkcs11ModulePath, String functionListName) |
137 throws IOException { |
|
137 connect(pkcs11ModulePath, functionListName); |
138 connect(pkcs11ModulePath, functionListName); |
138 this.pkcs11ModulePath = pkcs11ModulePath; |
139 this.pkcs11ModulePath = pkcs11ModulePath; |
139 } |
140 } |
140 |
141 |
141 public static synchronized PKCS11 getInstance(String pkcs11ModulePath, String functionList, |
142 public static synchronized PKCS11 getInstance(String pkcs11ModulePath, |
142 CK_C_INITIALIZE_ARGS pInitArgs, boolean omitInitialize) |
143 String functionList, CK_C_INITIALIZE_ARGS pInitArgs, |
143 throws IOException, PKCS11Exception { |
144 boolean omitInitialize) throws IOException, PKCS11Exception { |
144 // we may only call C_Initialize once per native .so/.dll |
145 // we may only call C_Initialize once per native .so/.dll |
145 // so keep a cache using the (non-canonicalized!) path |
146 // so keep a cache using the (non-canonicalized!) path |
146 PKCS11 pkcs11 = moduleMap.get(pkcs11ModulePath); |
147 PKCS11 pkcs11 = moduleMap.get(pkcs11ModulePath); |
147 if (pkcs11 == null) { |
148 if (pkcs11 == null) { |
148 if ((pInitArgs != null) |
149 if ((pInitArgs != null) |
175 * |
176 * |
176 * @param pkcs11ModulePath The PKCS#11 library path. |
177 * @param pkcs11ModulePath The PKCS#11 library path. |
177 * @preconditions (pkcs11ModulePath <> null) |
178 * @preconditions (pkcs11ModulePath <> null) |
178 * @postconditions |
179 * @postconditions |
179 */ |
180 */ |
180 private native void connect(String pkcs11ModulePath, String functionListName) throws IOException; |
181 private native void connect(String pkcs11ModulePath, String functionListName) |
182 throws IOException; |
|
181 |
183 |
182 /** |
184 /** |
183 * Disconnects the PKCS#11 library from this object. After calling this |
185 * Disconnects the PKCS#11 library from this object. After calling this |
184 * method, this object is no longer connected to a native PKCS#11 module |
186 * method, this object is no longer connected to a native PKCS#11 module |
185 * and any subsequent calls to C_ methods will fail. This method is for |
187 * and any subsequent calls to C_ methods will fail. This method is for |
253 * (PKCS#11 param: CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount) |
255 * (PKCS#11 param: CK_SLOT_ID_PTR pSlotList, CK_ULONG_PTR pulCount) |
254 * @exception PKCS11Exception If function returns other value than CKR_OK. |
256 * @exception PKCS11Exception If function returns other value than CKR_OK. |
255 * @preconditions |
257 * @preconditions |
256 * @postconditions (result <> null) |
258 * @postconditions (result <> null) |
257 */ |
259 */ |
258 public native long[] C_GetSlotList(boolean tokenPresent) throws PKCS11Exception; |
260 public native long[] C_GetSlotList(boolean tokenPresent) |
261 throws PKCS11Exception; |
|
259 |
262 |
260 |
263 |
261 /** |
264 /** |
262 * C_GetSlotInfo obtains information about a particular slot in |
265 * C_GetSlotInfo obtains information about a particular slot in |
263 * the system. |
266 * the system. |
285 * (PKCS#11 param: CK_TOKEN_INFO_PTR pInfo) |
288 * (PKCS#11 param: CK_TOKEN_INFO_PTR pInfo) |
286 * @exception PKCS11Exception If function returns other value than CKR_OK. |
289 * @exception PKCS11Exception If function returns other value than CKR_OK. |
287 * @preconditions |
290 * @preconditions |
288 * @postconditions (result <> null) |
291 * @postconditions (result <> null) |
289 */ |
292 */ |
290 public native CK_TOKEN_INFO C_GetTokenInfo(long slotID) throws PKCS11Exception; |
293 public native CK_TOKEN_INFO C_GetTokenInfo(long slotID) |
294 throws PKCS11Exception; |
|
291 |
295 |
292 |
296 |
293 /** |
297 /** |
294 * C_GetMechanismList obtains a list of mechanism types |
298 * C_GetMechanismList obtains a list of mechanism types |
295 * supported by a token. |
299 * supported by a token. |
320 * (PKCS#11 param: CK_MECHANISM_INFO_PTR pInfo) |
324 * (PKCS#11 param: CK_MECHANISM_INFO_PTR pInfo) |
321 * @exception PKCS11Exception If function returns other value than CKR_OK. |
325 * @exception PKCS11Exception If function returns other value than CKR_OK. |
322 * @preconditions |
326 * @preconditions |
323 * @postconditions (result <> null) |
327 * @postconditions (result <> null) |
324 */ |
328 */ |
325 public native CK_MECHANISM_INFO C_GetMechanismInfo(long slotID, long type) throws PKCS11Exception; |
329 public native CK_MECHANISM_INFO C_GetMechanismInfo(long slotID, long type) |
330 throws PKCS11Exception; |
|
326 |
331 |
327 |
332 |
328 /** |
333 /** |
329 * C_InitToken initializes a token. |
334 * C_InitToken initializes a token. |
330 * (Slot and token management) |
335 * (Slot and token management) |
337 * (PKCS#11 param: CK_UTF8CHAR_PTR pLabel) |
342 * (PKCS#11 param: CK_UTF8CHAR_PTR pLabel) |
338 * @exception PKCS11Exception If function returns other value than CKR_OK. |
343 * @exception PKCS11Exception If function returns other value than CKR_OK. |
339 * @preconditions |
344 * @preconditions |
340 * @postconditions |
345 * @postconditions |
341 */ |
346 */ |
342 // public native void C_InitToken(long slotID, char[] pPin, char[] pLabel) throws PKCS11Exception; |
347 // public native void C_InitToken(long slotID, char[] pPin, char[] pLabel) |
348 // throws PKCS11Exception; |
|
343 |
349 |
344 |
350 |
345 /** |
351 /** |
346 * C_InitPIN initializes the normal user's PIN. |
352 * C_InitPIN initializes the normal user's PIN. |
347 * (Slot and token management) |
353 * (Slot and token management) |
352 * (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen) |
358 * (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen) |
353 * @exception PKCS11Exception If function returns other value than CKR_OK. |
359 * @exception PKCS11Exception If function returns other value than CKR_OK. |
354 * @preconditions |
360 * @preconditions |
355 * @postconditions |
361 * @postconditions |
356 */ |
362 */ |
357 // public native void C_InitPIN(long hSession, char[] pPin) throws PKCS11Exception; |
363 // public native void C_InitPIN(long hSession, char[] pPin) |
364 // throws PKCS11Exception; |
|
358 |
365 |
359 |
366 |
360 /** |
367 /** |
361 * C_SetPIN modifies the PIN of the user who is logged in. |
368 * C_SetPIN modifies the PIN of the user who is logged in. |
362 * (Slot and token management) |
369 * (Slot and token management) |
369 * (PKCS#11 param: CK_CHAR_PTR pNewPin, CK_ULONG ulNewLen) |
376 * (PKCS#11 param: CK_CHAR_PTR pNewPin, CK_ULONG ulNewLen) |
370 * @exception PKCS11Exception If function returns other value than CKR_OK. |
377 * @exception PKCS11Exception If function returns other value than CKR_OK. |
371 * @preconditions |
378 * @preconditions |
372 * @postconditions |
379 * @postconditions |
373 */ |
380 */ |
374 // public native void C_SetPIN(long hSession, char[] pOldPin, char[] pNewPin) throws PKCS11Exception; |
381 // public native void C_SetPIN(long hSession, char[] pOldPin, char[] pNewPin) |
382 // throws PKCS11Exception; |
|
375 |
383 |
376 |
384 |
377 |
385 |
378 /* ***************************************************************************** |
386 /* ***************************************************************************** |
379 * Session management |
387 * Session management |
396 * (PKCS#11 param: CK_SESSION_HANDLE_PTR phSession) |
404 * (PKCS#11 param: CK_SESSION_HANDLE_PTR phSession) |
397 * @exception PKCS11Exception If function returns other value than CKR_OK. |
405 * @exception PKCS11Exception If function returns other value than CKR_OK. |
398 * @preconditions |
406 * @preconditions |
399 * @postconditions |
407 * @postconditions |
400 */ |
408 */ |
401 public native long C_OpenSession(long slotID, long flags, Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception; |
409 public native long C_OpenSession(long slotID, long flags, |
410 Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception; |
|
402 |
411 |
403 |
412 |
404 /** |
413 /** |
405 * C_CloseSession closes a session between an application and a |
414 * C_CloseSession closes a session between an application and a |
406 * token. |
415 * token. |
438 * (PKCS#11 param: CK_SESSION_INFO_PTR pInfo) |
447 * (PKCS#11 param: CK_SESSION_INFO_PTR pInfo) |
439 * @exception PKCS11Exception If function returns other value than CKR_OK. |
448 * @exception PKCS11Exception If function returns other value than CKR_OK. |
440 * @preconditions |
449 * @preconditions |
441 * @postconditions (result <> null) |
450 * @postconditions (result <> null) |
442 */ |
451 */ |
443 public native CK_SESSION_INFO C_GetSessionInfo(long hSession) throws PKCS11Exception; |
452 public native CK_SESSION_INFO C_GetSessionInfo(long hSession) |
453 throws PKCS11Exception; |
|
444 |
454 |
445 |
455 |
446 /** |
456 /** |
447 * C_GetOperationState obtains the state of the cryptographic operation |
457 * C_GetOperationState obtains the state of the cryptographic operation |
448 * in a session. |
458 * in a session. |
455 * CK_ULONG_PTR pulOperationStateLen) |
465 * CK_ULONG_PTR pulOperationStateLen) |
456 * @exception PKCS11Exception If function returns other value than CKR_OK. |
466 * @exception PKCS11Exception If function returns other value than CKR_OK. |
457 * @preconditions |
467 * @preconditions |
458 * @postconditions (result <> null) |
468 * @postconditions (result <> null) |
459 */ |
469 */ |
460 // public native byte[] C_GetOperationState(long hSession) throws PKCS11Exception; |
470 public native byte[] C_GetOperationState(long hSession) |
471 throws PKCS11Exception; |
|
461 |
472 |
462 |
473 |
463 /** |
474 /** |
464 * C_SetOperationState restores the state of the cryptographic |
475 * C_SetOperationState restores the state of the cryptographic |
465 * operation in a session. |
476 * operation in a session. |
476 * (PKCS#11 param: CK_OBJECT_HANDLE hAuthenticationKey) |
487 * (PKCS#11 param: CK_OBJECT_HANDLE hAuthenticationKey) |
477 * @exception PKCS11Exception If function returns other value than CKR_OK. |
488 * @exception PKCS11Exception If function returns other value than CKR_OK. |
478 * @preconditions |
489 * @preconditions |
479 * @postconditions |
490 * @postconditions |
480 */ |
491 */ |
481 // public native void C_SetOperationState(long hSession, byte[] pOperationState, long hEncryptionKey, long hAuthenticationKey) throws PKCS11Exception; |
492 public native void C_SetOperationState(long hSession, byte[] pOperationState, |
493 long hEncryptionKey, long hAuthenticationKey) throws PKCS11Exception; |
|
482 |
494 |
483 |
495 |
484 /** |
496 /** |
485 * C_Login logs a user into a token. |
497 * C_Login logs a user into a token. |
486 * (Session management) |
498 * (Session management) |
493 * (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen) |
505 * (PKCS#11 param: CK_CHAR_PTR pPin, CK_ULONG ulPinLen) |
494 * @exception PKCS11Exception If function returns other value than CKR_OK. |
506 * @exception PKCS11Exception If function returns other value than CKR_OK. |
495 * @preconditions |
507 * @preconditions |
496 * @postconditions |
508 * @postconditions |
497 */ |
509 */ |
498 public native void C_Login(long hSession, long userType, char[] pPin) throws PKCS11Exception; |
510 public native void C_Login(long hSession, long userType, char[] pPin) |
511 throws PKCS11Exception; |
|
499 |
512 |
500 |
513 |
501 /** |
514 /** |
502 * C_Logout logs a user out from a token. |
515 * C_Logout logs a user out from a token. |
503 * (Session management) |
516 * (Session management) |
529 * (PKCS#11 param: CK_OBJECT_HANDLE_PTR phObject) |
542 * (PKCS#11 param: CK_OBJECT_HANDLE_PTR phObject) |
530 * @exception PKCS11Exception If function returns other value than CKR_OK. |
543 * @exception PKCS11Exception If function returns other value than CKR_OK. |
531 * @preconditions |
544 * @preconditions |
532 * @postconditions |
545 * @postconditions |
533 */ |
546 */ |
534 public native long C_CreateObject(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
547 public native long C_CreateObject(long hSession, CK_ATTRIBUTE[] pTemplate) |
548 throws PKCS11Exception; |
|
535 |
549 |
536 |
550 |
537 /** |
551 /** |
538 * C_CopyObject copies an object, creating a new object for the |
552 * C_CopyObject copies an object, creating a new object for the |
539 * copy. |
553 * copy. |
550 * (PKCS#11 param: CK_OBJECT_HANDLE_PTR phNewObject) |
564 * (PKCS#11 param: CK_OBJECT_HANDLE_PTR phNewObject) |
551 * @exception PKCS11Exception If function returns other value than CKR_OK. |
565 * @exception PKCS11Exception If function returns other value than CKR_OK. |
552 * @preconditions |
566 * @preconditions |
553 * @postconditions |
567 * @postconditions |
554 */ |
568 */ |
555 public native long C_CopyObject(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
569 public native long C_CopyObject(long hSession, long hObject, |
570 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
|
556 |
571 |
557 |
572 |
558 /** |
573 /** |
559 * C_DestroyObject destroys an object. |
574 * C_DestroyObject destroys an object. |
560 * (Object management) |
575 * (Object management) |
565 * (PKCS#11 param: CK_OBJECT_HANDLE hObject) |
580 * (PKCS#11 param: CK_OBJECT_HANDLE hObject) |
566 * @exception PKCS11Exception If function returns other value than CKR_OK. |
581 * @exception PKCS11Exception If function returns other value than CKR_OK. |
567 * @preconditions |
582 * @preconditions |
568 * @postconditions |
583 * @postconditions |
569 */ |
584 */ |
570 public native void C_DestroyObject(long hSession, long hObject) throws PKCS11Exception; |
585 public native void C_DestroyObject(long hSession, long hObject) |
586 throws PKCS11Exception; |
|
571 |
587 |
572 |
588 |
573 /** |
589 /** |
574 * C_GetObjectSize gets the size of an object in bytes. |
590 * C_GetObjectSize gets the size of an object in bytes. |
575 * (Object management) |
591 * (Object management) |
582 * (PKCS#11 param: CK_ULONG_PTR pulSize) |
598 * (PKCS#11 param: CK_ULONG_PTR pulSize) |
583 * @exception PKCS11Exception If function returns other value than CKR_OK. |
599 * @exception PKCS11Exception If function returns other value than CKR_OK. |
584 * @preconditions |
600 * @preconditions |
585 * @postconditions |
601 * @postconditions |
586 */ |
602 */ |
587 // public native long C_GetObjectSize(long hSession, long hObject) throws PKCS11Exception; |
603 // public native long C_GetObjectSize(long hSession, long hObject) |
604 // throws PKCS11Exception; |
|
588 |
605 |
589 |
606 |
590 /** |
607 /** |
591 * C_GetAttributeValue obtains the value of one or more object |
608 * C_GetAttributeValue obtains the value of one or more object |
592 * attributes. The template attributes also receive the values. |
609 * attributes. The template attributes also receive the values. |
602 * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) |
619 * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) |
603 * @exception PKCS11Exception If function returns other value than CKR_OK. |
620 * @exception PKCS11Exception If function returns other value than CKR_OK. |
604 * @preconditions (pTemplate <> null) |
621 * @preconditions (pTemplate <> null) |
605 * @postconditions (result <> null) |
622 * @postconditions (result <> null) |
606 */ |
623 */ |
607 public native void C_GetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
624 public native void C_GetAttributeValue(long hSession, long hObject, |
625 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
|
608 |
626 |
609 |
627 |
610 /** |
628 /** |
611 * C_SetAttributeValue modifies the value of one or more object |
629 * C_SetAttributeValue modifies the value of one or more object |
612 * attributes |
630 * attributes |
621 * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) |
639 * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) |
622 * @exception PKCS11Exception If function returns other value than CKR_OK. |
640 * @exception PKCS11Exception If function returns other value than CKR_OK. |
623 * @preconditions (pTemplate <> null) |
641 * @preconditions (pTemplate <> null) |
624 * @postconditions |
642 * @postconditions |
625 */ |
643 */ |
626 public native void C_SetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
644 public native void C_SetAttributeValue(long hSession, long hObject, |
645 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
|
627 |
646 |
628 |
647 |
629 /** |
648 /** |
630 * C_FindObjectsInit initializes a search for token and session |
649 * C_FindObjectsInit initializes a search for token and session |
631 * objects that match a template. |
650 * objects that match a template. |
638 * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) |
657 * (PKCS#11 param: CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) |
639 * @exception PKCS11Exception If function returns other value than CKR_OK. |
658 * @exception PKCS11Exception If function returns other value than CKR_OK. |
640 * @preconditions |
659 * @preconditions |
641 * @postconditions |
660 * @postconditions |
642 */ |
661 */ |
643 public native void C_FindObjectsInit(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
662 public native void C_FindObjectsInit(long hSession, CK_ATTRIBUTE[] pTemplate) |
663 throws PKCS11Exception; |
|
644 |
664 |
645 |
665 |
646 /** |
666 /** |
647 * C_FindObjects continues a search for token and session |
667 * C_FindObjects continues a search for token and session |
648 * objects that match a template, obtaining additional object |
668 * objects that match a template, obtaining additional object |
657 * (PKCS#11 param: CK_ULONG_PTR pulObjectCount) |
677 * (PKCS#11 param: CK_ULONG_PTR pulObjectCount) |
658 * @exception PKCS11Exception If function returns other value than CKR_OK. |
678 * @exception PKCS11Exception If function returns other value than CKR_OK. |
659 * @preconditions |
679 * @preconditions |
660 * @postconditions (result <> null) |
680 * @postconditions (result <> null) |
661 */ |
681 */ |
662 public native long[] C_FindObjects(long hSession, long ulMaxObjectCount) throws PKCS11Exception; |
682 public native long[] C_FindObjects(long hSession, long ulMaxObjectCount) |
683 throws PKCS11Exception; |
|
663 |
684 |
664 |
685 |
665 /** |
686 /** |
666 * C_FindObjectsFinal finishes a search for token and session |
687 * C_FindObjectsFinal finishes a search for token and session |
667 * objects. |
688 * objects. |
693 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
714 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
694 * @exception PKCS11Exception If function returns other value than CKR_OK. |
715 * @exception PKCS11Exception If function returns other value than CKR_OK. |
695 * @preconditions |
716 * @preconditions |
696 * @postconditions |
717 * @postconditions |
697 */ |
718 */ |
698 public native void C_EncryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; |
719 public native void C_EncryptInit(long hSession, CK_MECHANISM pMechanism, |
720 long hKey) throws PKCS11Exception; |
|
699 |
721 |
700 |
722 |
701 /** |
723 /** |
702 * C_Encrypt encrypts single-part data. |
724 * C_Encrypt encrypts single-part data. |
703 * (Encryption and decryption) |
725 * (Encryption and decryption) |
711 * CK_ULONG_PTR pulEncryptedDataLen) |
733 * CK_ULONG_PTR pulEncryptedDataLen) |
712 * @exception PKCS11Exception If function returns other value than CKR_OK. |
734 * @exception PKCS11Exception If function returns other value than CKR_OK. |
713 * @preconditions (pData <> null) |
735 * @preconditions (pData <> null) |
714 * @postconditions (result <> null) |
736 * @postconditions (result <> null) |
715 */ |
737 */ |
716 public native int C_Encrypt(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOfs, int outLen) throws PKCS11Exception; |
738 public native int C_Encrypt(long hSession, byte[] in, int inOfs, int inLen, |
739 byte[] out, int outOfs, int outLen) throws PKCS11Exception; |
|
717 |
740 |
718 |
741 |
719 /** |
742 /** |
720 * C_EncryptUpdate continues a multiple-part encryption |
743 * C_EncryptUpdate continues a multiple-part encryption |
721 * operation. |
744 * operation. |
730 CK_ULONG_PTR pulEncryptedPartLen) |
753 CK_ULONG_PTR pulEncryptedPartLen) |
731 * @exception PKCS11Exception If function returns other value than CKR_OK. |
754 * @exception PKCS11Exception If function returns other value than CKR_OK. |
732 * @preconditions (pPart <> null) |
755 * @preconditions (pPart <> null) |
733 * @postconditions |
756 * @postconditions |
734 */ |
757 */ |
735 public native int C_EncryptUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception; |
758 public native int C_EncryptUpdate(long hSession, long directIn, byte[] in, |
759 int inOfs, int inLen, long directOut, byte[] out, int outOfs, |
|
760 int outLen) throws PKCS11Exception; |
|
736 |
761 |
737 |
762 |
738 /** |
763 /** |
739 * C_EncryptFinal finishes a multiple-part encryption |
764 * C_EncryptFinal finishes a multiple-part encryption |
740 * operation. |
765 * operation. |
747 CK_ULONG_PTR pulLastEncryptedPartLen) |
772 CK_ULONG_PTR pulLastEncryptedPartLen) |
748 * @exception PKCS11Exception If function returns other value than CKR_OK. |
773 * @exception PKCS11Exception If function returns other value than CKR_OK. |
749 * @preconditions |
774 * @preconditions |
750 * @postconditions (result <> null) |
775 * @postconditions (result <> null) |
751 */ |
776 */ |
752 public native int C_EncryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception; |
777 public native int C_EncryptFinal(long hSession, long directOut, byte[] out, |
778 int outOfs, int outLen) throws PKCS11Exception; |
|
753 |
779 |
754 |
780 |
755 /** |
781 /** |
756 * C_DecryptInit initializes a decryption operation. |
782 * C_DecryptInit initializes a decryption operation. |
757 * (Encryption and decryption) |
783 * (Encryption and decryption) |
764 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
790 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
765 * @exception PKCS11Exception If function returns other value than CKR_OK. |
791 * @exception PKCS11Exception If function returns other value than CKR_OK. |
766 * @preconditions |
792 * @preconditions |
767 * @postconditions |
793 * @postconditions |
768 */ |
794 */ |
769 public native void C_DecryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; |
795 public native void C_DecryptInit(long hSession, CK_MECHANISM pMechanism, |
796 long hKey) throws PKCS11Exception; |
|
770 |
797 |
771 |
798 |
772 /** |
799 /** |
773 * C_Decrypt decrypts encrypted data in a single part. |
800 * C_Decrypt decrypts encrypted data in a single part. |
774 * (Encryption and decryption) |
801 * (Encryption and decryption) |
783 * (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen) |
810 * (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen) |
784 * @exception PKCS11Exception If function returns other value than CKR_OK. |
811 * @exception PKCS11Exception If function returns other value than CKR_OK. |
785 * @preconditions (pEncryptedPart <> null) |
812 * @preconditions (pEncryptedPart <> null) |
786 * @postconditions (result <> null) |
813 * @postconditions (result <> null) |
787 */ |
814 */ |
788 public native int C_Decrypt(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOfs, int outLen) throws PKCS11Exception; |
815 public native int C_Decrypt(long hSession, byte[] in, int inOfs, int inLen, |
816 byte[] out, int outOfs, int outLen) throws PKCS11Exception; |
|
789 |
817 |
790 |
818 |
791 /** |
819 /** |
792 * C_DecryptUpdate continues a multiple-part decryption |
820 * C_DecryptUpdate continues a multiple-part decryption |
793 * operation. |
821 * operation. |
803 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) |
831 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) |
804 * @exception PKCS11Exception If function returns other value than CKR_OK. |
832 * @exception PKCS11Exception If function returns other value than CKR_OK. |
805 * @preconditions (pEncryptedPart <> null) |
833 * @preconditions (pEncryptedPart <> null) |
806 * @postconditions |
834 * @postconditions |
807 */ |
835 */ |
808 public native int C_DecryptUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception; |
836 public native int C_DecryptUpdate(long hSession, long directIn, byte[] in, |
837 int inOfs, int inLen, long directOut, byte[] out, int outOfs, |
|
838 int outLen) throws PKCS11Exception; |
|
809 |
839 |
810 |
840 |
811 /** |
841 /** |
812 * C_DecryptFinal finishes a multiple-part decryption |
842 * C_DecryptFinal finishes a multiple-part decryption |
813 * operation. |
843 * operation. |
820 * CK_ULONG_PTR pulLastPartLen) |
850 * CK_ULONG_PTR pulLastPartLen) |
821 * @exception PKCS11Exception If function returns other value than CKR_OK. |
851 * @exception PKCS11Exception If function returns other value than CKR_OK. |
822 * @preconditions |
852 * @preconditions |
823 * @postconditions (result <> null) |
853 * @postconditions (result <> null) |
824 */ |
854 */ |
825 public native int C_DecryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception; |
855 public native int C_DecryptFinal(long hSession, long directOut, byte[] out, |
856 int outOfs, int outLen) throws PKCS11Exception; |
|
826 |
857 |
827 |
858 |
828 |
859 |
829 /* ***************************************************************************** |
860 /* ***************************************************************************** |
830 * Message digesting |
861 * Message digesting |
840 * (PKCS#11 param: CK_MECHANISM_PTR pMechanism) |
871 * (PKCS#11 param: CK_MECHANISM_PTR pMechanism) |
841 * @exception PKCS11Exception If function returns other value than CKR_OK. |
872 * @exception PKCS11Exception If function returns other value than CKR_OK. |
842 * @preconditions |
873 * @preconditions |
843 * @postconditions |
874 * @postconditions |
844 */ |
875 */ |
845 public native void C_DigestInit(long hSession, CK_MECHANISM pMechanism) throws PKCS11Exception; |
876 public native void C_DigestInit(long hSession, CK_MECHANISM pMechanism) |
877 throws PKCS11Exception; |
|
846 |
878 |
847 |
879 |
848 // note that C_DigestSingle does not exist in PKCS#11 |
880 // note that C_DigestSingle does not exist in PKCS#11 |
849 // we combined the C_DigestInit and C_Digest into a single function |
881 // we combined the C_DigestInit and C_Digest into a single function |
850 // to save on Java<->C transitions and save 5-10% on small digests |
882 // to save on Java<->C transitions and save 5-10% on small digests |
861 * (PKCS#11 param: CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen) |
893 * (PKCS#11 param: CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen) |
862 * @exception PKCS11Exception If function returns other value than CKR_OK. |
894 * @exception PKCS11Exception If function returns other value than CKR_OK. |
863 * @preconditions (data <> null) |
895 * @preconditions (data <> null) |
864 * @postconditions (result <> null) |
896 * @postconditions (result <> null) |
865 */ |
897 */ |
866 public native int C_DigestSingle(long hSession, CK_MECHANISM pMechanism, byte[] in, int inOfs, int inLen, byte[] digest, int digestOfs, int digestLen) throws PKCS11Exception; |
898 public native int C_DigestSingle(long hSession, CK_MECHANISM pMechanism, |
899 byte[] in, int inOfs, int inLen, byte[] digest, int digestOfs, |
|
900 int digestLen) throws PKCS11Exception; |
|
867 |
901 |
868 |
902 |
869 /** |
903 /** |
870 * C_DigestUpdate continues a multiple-part message-digesting |
904 * C_DigestUpdate continues a multiple-part message-digesting |
871 * operation. |
905 * operation. |
877 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen) |
911 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen) |
878 * @exception PKCS11Exception If function returns other value than CKR_OK. |
912 * @exception PKCS11Exception If function returns other value than CKR_OK. |
879 * @preconditions (pPart <> null) |
913 * @preconditions (pPart <> null) |
880 * @postconditions |
914 * @postconditions |
881 */ |
915 */ |
882 public native void C_DigestUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception; |
916 public native void C_DigestUpdate(long hSession, long directIn, byte[] in, |
917 int inOfs, int inLen) throws PKCS11Exception; |
|
883 |
918 |
884 |
919 |
885 /** |
920 /** |
886 * C_DigestKey continues a multi-part message-digesting |
921 * C_DigestKey continues a multi-part message-digesting |
887 * operation, by digesting the value of a secret key as part of |
922 * operation, by digesting the value of a secret key as part of |
894 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
929 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
895 * @exception PKCS11Exception If function returns other value than CKR_OK. |
930 * @exception PKCS11Exception If function returns other value than CKR_OK. |
896 * @preconditions |
931 * @preconditions |
897 * @postconditions |
932 * @postconditions |
898 */ |
933 */ |
899 public native void C_DigestKey(long hSession, long hKey) throws PKCS11Exception; |
934 public native void C_DigestKey(long hSession, long hKey) |
935 throws PKCS11Exception; |
|
900 |
936 |
901 |
937 |
902 /** |
938 /** |
903 * C_DigestFinal finishes a multiple-part message-digesting |
939 * C_DigestFinal finishes a multiple-part message-digesting |
904 * operation. |
940 * operation. |
910 * (PKCS#11 param: CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen) |
946 * (PKCS#11 param: CK_BYTE_PTR pDigest, CK_ULONG_PTR pulDigestLen) |
911 * @exception PKCS11Exception If function returns other value than CKR_OK. |
947 * @exception PKCS11Exception If function returns other value than CKR_OK. |
912 * @preconditions |
948 * @preconditions |
913 * @postconditions (result <> null) |
949 * @postconditions (result <> null) |
914 */ |
950 */ |
915 public native int C_DigestFinal(long hSession, byte[] pDigest, int digestOfs, int digestLen) throws PKCS11Exception; |
951 public native int C_DigestFinal(long hSession, byte[] pDigest, int digestOfs, |
952 int digestLen) throws PKCS11Exception; |
|
916 |
953 |
917 |
954 |
918 |
955 |
919 /* ***************************************************************************** |
956 /* ***************************************************************************** |
920 * Signing and MACing |
957 * Signing and MACing |
935 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
972 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
936 * @exception PKCS11Exception If function returns other value than CKR_OK. |
973 * @exception PKCS11Exception If function returns other value than CKR_OK. |
937 * @preconditions |
974 * @preconditions |
938 * @postconditions |
975 * @postconditions |
939 */ |
976 */ |
940 public native void C_SignInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; |
977 public native void C_SignInit(long hSession, CK_MECHANISM pMechanism, |
978 long hKey) throws PKCS11Exception; |
|
941 |
979 |
942 |
980 |
943 /** |
981 /** |
944 * C_Sign signs (encrypts with private key) data in a single |
982 * C_Sign signs (encrypts with private key) data in a single |
945 * part, where the signature is (will be) an appendix to the |
983 * part, where the signature is (will be) an appendix to the |
955 * CK_ULONG_PTR pulSignatureLen) |
993 * CK_ULONG_PTR pulSignatureLen) |
956 * @exception PKCS11Exception If function returns other value than CKR_OK. |
994 * @exception PKCS11Exception If function returns other value than CKR_OK. |
957 * @preconditions (pData <> null) |
995 * @preconditions (pData <> null) |
958 * @postconditions (result <> null) |
996 * @postconditions (result <> null) |
959 */ |
997 */ |
960 public native byte[] C_Sign(long hSession, byte[] pData) throws PKCS11Exception; |
998 public native byte[] C_Sign(long hSession, byte[] pData) |
999 throws PKCS11Exception; |
|
961 |
1000 |
962 |
1001 |
963 /** |
1002 /** |
964 * C_SignUpdate continues a multiple-part signature operation, |
1003 * C_SignUpdate continues a multiple-part signature operation, |
965 * where the signature is (will be) an appendix to the data, |
1004 * where the signature is (will be) an appendix to the data, |
972 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen) |
1011 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen) |
973 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1012 * @exception PKCS11Exception If function returns other value than CKR_OK. |
974 * @preconditions (pPart <> null) |
1013 * @preconditions (pPart <> null) |
975 * @postconditions |
1014 * @postconditions |
976 */ |
1015 */ |
977 public native void C_SignUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception; |
1016 public native void C_SignUpdate(long hSession, long directIn, byte[] in, |
1017 int inOfs, int inLen) throws PKCS11Exception; |
|
978 |
1018 |
979 |
1019 |
980 /** |
1020 /** |
981 * C_SignFinal finishes a multiple-part signature operation, |
1021 * C_SignFinal finishes a multiple-part signature operation, |
982 * returning the signature. |
1022 * returning the signature. |
989 * CK_ULONG_PTR pulSignatureLen) |
1029 * CK_ULONG_PTR pulSignatureLen) |
990 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1030 * @exception PKCS11Exception If function returns other value than CKR_OK. |
991 * @preconditions |
1031 * @preconditions |
992 * @postconditions (result <> null) |
1032 * @postconditions (result <> null) |
993 */ |
1033 */ |
994 public native byte[] C_SignFinal(long hSession, int expectedLen) throws PKCS11Exception; |
1034 public native byte[] C_SignFinal(long hSession, int expectedLen) |
1035 throws PKCS11Exception; |
|
995 |
1036 |
996 |
1037 |
997 /** |
1038 /** |
998 * C_SignRecoverInit initializes a signature operation, where |
1039 * C_SignRecoverInit initializes a signature operation, where |
999 * the data can be recovered from the signature. |
1040 * the data can be recovered from the signature. |
1007 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
1048 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
1008 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1049 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1009 * @preconditions |
1050 * @preconditions |
1010 * @postconditions |
1051 * @postconditions |
1011 */ |
1052 */ |
1012 public native void C_SignRecoverInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; |
1053 public native void C_SignRecoverInit(long hSession, CK_MECHANISM pMechanism, |
1054 long hKey) throws PKCS11Exception; |
|
1013 |
1055 |
1014 |
1056 |
1015 /** |
1057 /** |
1016 * C_SignRecover signs data in a single operation, where the |
1058 * C_SignRecover signs data in a single operation, where the |
1017 * data can be recovered from the signature. |
1059 * data can be recovered from the signature. |
1026 * CK_ULONG_PTR pulSignatureLen) |
1068 * CK_ULONG_PTR pulSignatureLen) |
1027 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1069 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1028 * @preconditions (pData <> null) |
1070 * @preconditions (pData <> null) |
1029 * @postconditions (result <> null) |
1071 * @postconditions (result <> null) |
1030 */ |
1072 */ |
1031 public native int C_SignRecover(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOufs, int outLen) throws PKCS11Exception; |
1073 public native int C_SignRecover(long hSession, byte[] in, int inOfs, |
1074 int inLen, byte[] out, int outOufs, int outLen) |
|
1075 throws PKCS11Exception; |
|
1032 |
1076 |
1033 |
1077 |
1034 |
1078 |
1035 /* ***************************************************************************** |
1079 /* ***************************************************************************** |
1036 * Verifying signatures and MACs |
1080 * Verifying signatures and MACs |
1050 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
1094 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
1051 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1095 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1052 * @preconditions |
1096 * @preconditions |
1053 * @postconditions |
1097 * @postconditions |
1054 */ |
1098 */ |
1055 public native void C_VerifyInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; |
1099 public native void C_VerifyInit(long hSession, CK_MECHANISM pMechanism, |
1100 long hKey) throws PKCS11Exception; |
|
1056 |
1101 |
1057 |
1102 |
1058 /** |
1103 /** |
1059 * C_Verify verifies a signature in a single-part operation, |
1104 * C_Verify verifies a signature in a single-part operation, |
1060 * where the signature is an appendix to the data, and plaintext |
1105 * where the signature is an appendix to the data, and plaintext |
1069 * (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen) |
1114 * (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen) |
1070 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1115 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1071 * @preconditions (pData <> null) and (pSignature <> null) |
1116 * @preconditions (pData <> null) and (pSignature <> null) |
1072 * @postconditions |
1117 * @postconditions |
1073 */ |
1118 */ |
1074 public native void C_Verify(long hSession, byte[] pData, byte[] pSignature) throws PKCS11Exception; |
1119 public native void C_Verify(long hSession, byte[] pData, byte[] pSignature) |
1120 throws PKCS11Exception; |
|
1075 |
1121 |
1076 |
1122 |
1077 /** |
1123 /** |
1078 * C_VerifyUpdate continues a multiple-part verification |
1124 * C_VerifyUpdate continues a multiple-part verification |
1079 * operation, where the signature is an appendix to the data, |
1125 * operation, where the signature is an appendix to the data, |
1086 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen) |
1132 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG ulPartLen) |
1087 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1133 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1088 * @preconditions (pPart <> null) |
1134 * @preconditions (pPart <> null) |
1089 * @postconditions |
1135 * @postconditions |
1090 */ |
1136 */ |
1091 public native void C_VerifyUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception; |
1137 public native void C_VerifyUpdate(long hSession, long directIn, byte[] in, |
1138 int inOfs, int inLen) throws PKCS11Exception; |
|
1092 |
1139 |
1093 |
1140 |
1094 /** |
1141 /** |
1095 * C_VerifyFinal finishes a multiple-part verification |
1142 * C_VerifyFinal finishes a multiple-part verification |
1096 * operation, checking the signature. |
1143 * operation, checking the signature. |
1102 * (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen) |
1149 * (PKCS#11 param: CK_BYTE_PTR pSignature, CK_ULONG ulSignatureLen) |
1103 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1150 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1104 * @preconditions (pSignature <> null) |
1151 * @preconditions (pSignature <> null) |
1105 * @postconditions |
1152 * @postconditions |
1106 */ |
1153 */ |
1107 public native void C_VerifyFinal(long hSession, byte[] pSignature) throws PKCS11Exception; |
1154 public native void C_VerifyFinal(long hSession, byte[] pSignature) |
1155 throws PKCS11Exception; |
|
1108 |
1156 |
1109 |
1157 |
1110 /** |
1158 /** |
1111 * C_VerifyRecoverInit initializes a signature verification |
1159 * C_VerifyRecoverInit initializes a signature verification |
1112 * operation, where the data is recovered from the signature. |
1160 * operation, where the data is recovered from the signature. |
1120 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
1168 * (PKCS#11 param: CK_OBJECT_HANDLE hKey) |
1121 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1169 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1122 * @preconditions |
1170 * @preconditions |
1123 * @postconditions |
1171 * @postconditions |
1124 */ |
1172 */ |
1125 public native void C_VerifyRecoverInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; |
1173 public native void C_VerifyRecoverInit(long hSession, |
1174 CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception; |
|
1126 |
1175 |
1127 |
1176 |
1128 /** |
1177 /** |
1129 * C_VerifyRecover verifies a signature in a single-part |
1178 * C_VerifyRecover verifies a signature in a single-part |
1130 * operation, where the data is recovered from the signature. |
1179 * operation, where the data is recovered from the signature. |
1138 * (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen) |
1187 * (PKCS#11 param: CK_BYTE_PTR pData, CK_ULONG_PTR pulDataLen) |
1139 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1188 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1140 * @preconditions (pSignature <> null) |
1189 * @preconditions (pSignature <> null) |
1141 * @postconditions (result <> null) |
1190 * @postconditions (result <> null) |
1142 */ |
1191 */ |
1143 public native int C_VerifyRecover(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOufs, int outLen) throws PKCS11Exception; |
1192 public native int C_VerifyRecover(long hSession, byte[] in, int inOfs, |
1193 int inLen, byte[] out, int outOufs, int outLen) |
|
1194 throws PKCS11Exception; |
|
1144 |
1195 |
1145 |
1196 |
1146 |
1197 |
1147 /* ***************************************************************************** |
1198 /* ***************************************************************************** |
1148 * Dual-function cryptographic operations |
1199 * Dual-function cryptographic operations |
1162 * CK_ULONG_PTR pulEncryptedPartLen) |
1213 * CK_ULONG_PTR pulEncryptedPartLen) |
1163 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1214 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1164 * @preconditions (pPart <> null) |
1215 * @preconditions (pPart <> null) |
1165 * @postconditions |
1216 * @postconditions |
1166 */ |
1217 */ |
1167 // public native byte[] C_DigestEncryptUpdate(long hSession, byte[] pPart) throws PKCS11Exception; |
1218 // public native byte[] C_DigestEncryptUpdate(long hSession, byte[] pPart) |
1219 // throws PKCS11Exception; |
|
1168 |
1220 |
1169 |
1221 |
1170 /** |
1222 /** |
1171 * C_DecryptDigestUpdate continues a multiple-part decryption and |
1223 * C_DecryptDigestUpdate continues a multiple-part decryption and |
1172 * digesting operation. |
1224 * digesting operation. |
1182 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) |
1234 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) |
1183 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1235 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1184 * @preconditions (pEncryptedPart <> null) |
1236 * @preconditions (pEncryptedPart <> null) |
1185 * @postconditions |
1237 * @postconditions |
1186 */ |
1238 */ |
1187 // public native byte[] C_DecryptDigestUpdate(long hSession, byte[] pEncryptedPart) throws PKCS11Exception; |
1239 // public native byte[] C_DecryptDigestUpdate(long hSession, |
1240 // byte[] pEncryptedPart) throws PKCS11Exception; |
|
1188 |
1241 |
1189 |
1242 |
1190 /** |
1243 /** |
1191 * C_SignEncryptUpdate continues a multiple-part signing and |
1244 * C_SignEncryptUpdate continues a multiple-part signing and |
1192 * encryption operation. |
1245 * encryption operation. |
1202 * CK_ULONG_PTR pulEncryptedPartLen) |
1255 * CK_ULONG_PTR pulEncryptedPartLen) |
1203 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1256 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1204 * @preconditions (pPart <> null) |
1257 * @preconditions (pPart <> null) |
1205 * @postconditions |
1258 * @postconditions |
1206 */ |
1259 */ |
1207 // public native byte[] C_SignEncryptUpdate(long hSession, byte[] pPart) throws PKCS11Exception; |
1260 // public native byte[] C_SignEncryptUpdate(long hSession, byte[] pPart) |
1261 // throws PKCS11Exception; |
|
1208 |
1262 |
1209 |
1263 |
1210 /** |
1264 /** |
1211 * C_DecryptVerifyUpdate continues a multiple-part decryption and |
1265 * C_DecryptVerifyUpdate continues a multiple-part decryption and |
1212 * verify operation. |
1266 * verify operation. |
1222 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) |
1276 * (PKCS#11 param: CK_BYTE_PTR pPart, CK_ULONG_PTR pulPartLen) |
1223 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1277 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1224 * @preconditions (pEncryptedPart <> null) |
1278 * @preconditions (pEncryptedPart <> null) |
1225 * @postconditions |
1279 * @postconditions |
1226 */ |
1280 */ |
1227 // public native byte[] C_DecryptVerifyUpdate(long hSession, byte[] pEncryptedPart) throws PKCS11Exception; |
1281 // public native byte[] C_DecryptVerifyUpdate(long hSession, |
1282 // byte[] pEncryptedPart) throws PKCS11Exception; |
|
1228 |
1283 |
1229 |
1284 |
1230 |
1285 |
1231 /* ***************************************************************************** |
1286 /* ***************************************************************************** |
1232 * Key management |
1287 * Key management |
1248 * (PKCS#11 param: CK_OBJECT_HANDLE_PTR phKey) |
1303 * (PKCS#11 param: CK_OBJECT_HANDLE_PTR phKey) |
1249 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1304 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1250 * @preconditions |
1305 * @preconditions |
1251 * @postconditions |
1306 * @postconditions |
1252 */ |
1307 */ |
1253 public native long C_GenerateKey(long hSession, CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
1308 public native long C_GenerateKey(long hSession, CK_MECHANISM pMechanism, |
1309 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
|
1254 |
1310 |
1255 |
1311 |
1256 /** |
1312 /** |
1257 * C_GenerateKeyPair generates a public-key/private-key pair, |
1313 * C_GenerateKeyPair generates a public-key/private-key pair, |
1258 * creating new key objects. |
1314 * creating new key objects. |
1278 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1334 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1279 * @preconditions (pMechanism <> null) |
1335 * @preconditions (pMechanism <> null) |
1280 * @postconditions (result <> null) and (result.length == 2) |
1336 * @postconditions (result <> null) and (result.length == 2) |
1281 */ |
1337 */ |
1282 public native long[] C_GenerateKeyPair(long hSession, |
1338 public native long[] C_GenerateKeyPair(long hSession, |
1283 CK_MECHANISM pMechanism, |
1339 CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pPublicKeyTemplate, |
1284 CK_ATTRIBUTE[] pPublicKeyTemplate, |
1340 CK_ATTRIBUTE[] pPrivateKeyTemplate) throws PKCS11Exception; |
1285 CK_ATTRIBUTE[] pPrivateKeyTemplate) throws PKCS11Exception; |
|
1286 |
1341 |
1287 |
1342 |
1288 |
1343 |
1289 /** |
1344 /** |
1290 * C_WrapKey wraps (i.e., encrypts) a key. |
1345 * C_WrapKey wraps (i.e., encrypts) a key. |
1303 * CK_ULONG_PTR pulWrappedKeyLen) |
1358 * CK_ULONG_PTR pulWrappedKeyLen) |
1304 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1359 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1305 * @preconditions |
1360 * @preconditions |
1306 * @postconditions (result <> null) |
1361 * @postconditions (result <> null) |
1307 */ |
1362 */ |
1308 public native byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism, long hWrappingKey, long hKey) throws PKCS11Exception; |
1363 public native byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism, |
1364 long hWrappingKey, long hKey) throws PKCS11Exception; |
|
1309 |
1365 |
1310 |
1366 |
1311 /** |
1367 /** |
1312 * C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new |
1368 * C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new |
1313 * key object. |
1369 * key object. |
1329 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1385 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1330 * @preconditions (pWrappedKey <> null) |
1386 * @preconditions (pWrappedKey <> null) |
1331 * @postconditions |
1387 * @postconditions |
1332 */ |
1388 */ |
1333 public native long C_UnwrapKey(long hSession, CK_MECHANISM pMechanism, |
1389 public native long C_UnwrapKey(long hSession, CK_MECHANISM pMechanism, |
1334 long hUnwrappingKey, byte[] pWrappedKey, |
1390 long hUnwrappingKey, byte[] pWrappedKey, CK_ATTRIBUTE[] pTemplate) |
1335 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
1391 throws PKCS11Exception; |
1336 |
1392 |
1337 |
1393 |
1338 /** |
1394 /** |
1339 * C_DeriveKey derives a key from a base key, creating a new key |
1395 * C_DeriveKey derives a key from a base key, creating a new key |
1340 * object. |
1396 * object. |
1354 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1410 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1355 * @preconditions |
1411 * @preconditions |
1356 * @postconditions |
1412 * @postconditions |
1357 */ |
1413 */ |
1358 public native long C_DeriveKey(long hSession, CK_MECHANISM pMechanism, |
1414 public native long C_DeriveKey(long hSession, CK_MECHANISM pMechanism, |
1359 long hBaseKey, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
1415 long hBaseKey, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception; |
1360 |
1416 |
1361 |
1417 |
1362 |
1418 |
1363 /* ***************************************************************************** |
1419 /* ***************************************************************************** |
1364 * Random number generation |
1420 * Random number generation |
1375 * (PKCS#11 param: CK_BYTE_PTR pSeed, CK_ULONG ulSeedLen) |
1431 * (PKCS#11 param: CK_BYTE_PTR pSeed, CK_ULONG ulSeedLen) |
1376 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1432 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1377 * @preconditions (pSeed <> null) |
1433 * @preconditions (pSeed <> null) |
1378 * @postconditions |
1434 * @postconditions |
1379 */ |
1435 */ |
1380 public native void C_SeedRandom(long hSession, byte[] pSeed) throws PKCS11Exception; |
1436 public native void C_SeedRandom(long hSession, byte[] pSeed) |
1437 throws PKCS11Exception; |
|
1381 |
1438 |
1382 |
1439 |
1383 /** |
1440 /** |
1384 * C_GenerateRandom generates random data. |
1441 * C_GenerateRandom generates random data. |
1385 * (Random number generation) |
1442 * (Random number generation) |
1391 * (PKCS#11 param: CK_BYTE_PTR pRandomData, CK_ULONG ulRandomLen) |
1448 * (PKCS#11 param: CK_BYTE_PTR pRandomData, CK_ULONG ulRandomLen) |
1392 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1449 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1393 * @preconditions (randomData <> null) |
1450 * @preconditions (randomData <> null) |
1394 * @postconditions |
1451 * @postconditions |
1395 */ |
1452 */ |
1396 public native void C_GenerateRandom(long hSession, byte[] randomData) throws PKCS11Exception; |
1453 public native void C_GenerateRandom(long hSession, byte[] randomData) |
1454 throws PKCS11Exception; |
|
1397 |
1455 |
1398 |
1456 |
1399 |
1457 |
1400 /* ***************************************************************************** |
1458 /* ***************************************************************************** |
1401 * Parallel function management |
1459 * Parallel function management |
1411 * (PKCS#11 param: CK_SESSION_HANDLE hSession) |
1469 * (PKCS#11 param: CK_SESSION_HANDLE hSession) |
1412 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1470 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1413 * @preconditions |
1471 * @preconditions |
1414 * @postconditions |
1472 * @postconditions |
1415 */ |
1473 */ |
1416 // public native void C_GetFunctionStatus(long hSession) throws PKCS11Exception; |
1474 // public native void C_GetFunctionStatus(long hSession) |
1475 // throws PKCS11Exception; |
|
1417 |
1476 |
1418 |
1477 |
1419 /** |
1478 /** |
1420 * C_CancelFunction is a legacy function; it cancels a function |
1479 * C_CancelFunction is a legacy function; it cancels a function |
1421 * running in parallel. |
1480 * running in parallel. |
1448 * (PKCS#11 param: CK_SLOT_ID_PTR pSlot) |
1507 * (PKCS#11 param: CK_SLOT_ID_PTR pSlot) |
1449 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1508 * @exception PKCS11Exception If function returns other value than CKR_OK. |
1450 * @preconditions (pRserved == null) |
1509 * @preconditions (pRserved == null) |
1451 * @postconditions |
1510 * @postconditions |
1452 */ |
1511 */ |
1453 // public native long C_WaitForSlotEvent(long flags, Object pRserved) throws PKCS11Exception; |
1512 // public native long C_WaitForSlotEvent(long flags, Object pRserved) |
1513 // throws PKCS11Exception; |
|
1454 |
1514 |
1455 /** |
1515 /** |
1456 * Returns the string representation of this object. |
1516 * Returns the string representation of this object. |
1457 * |
1517 * |
1458 * @return The string representation of object |
1518 * @return The string representation of object |
1474 |
1534 |
1475 // PKCS11 subclass that has all methods synchronized and delegating to the |
1535 // PKCS11 subclass that has all methods synchronized and delegating to the |
1476 // parent. Used for tokens that only support single threaded access |
1536 // parent. Used for tokens that only support single threaded access |
1477 static class SynchronizedPKCS11 extends PKCS11 { |
1537 static class SynchronizedPKCS11 extends PKCS11 { |
1478 |
1538 |
1479 SynchronizedPKCS11(String pkcs11ModulePath, String functionListName) throws IOException { |
1539 SynchronizedPKCS11(String pkcs11ModulePath, String functionListName) |
1540 throws IOException { |
|
1480 super(pkcs11ModulePath, functionListName); |
1541 super(pkcs11ModulePath, functionListName); |
1481 } |
1542 } |
1482 |
1543 |
1483 synchronized void C_Initialize(Object pInitArgs) throws PKCS11Exception { |
1544 synchronized void C_Initialize(Object pInitArgs) throws PKCS11Exception { |
1484 super.C_Initialize(pInitArgs); |
1545 super.C_Initialize(pInitArgs); |
1485 } |
1546 } |
1486 |
1547 |
1487 public synchronized void C_Finalize(Object pReserved) throws PKCS11Exception { |
1548 public synchronized void C_Finalize(Object pReserved) |
1549 throws PKCS11Exception { |
|
1488 super.C_Finalize(pReserved); |
1550 super.C_Finalize(pReserved); |
1489 } |
1551 } |
1490 |
1552 |
1491 public synchronized CK_INFO C_GetInfo() throws PKCS11Exception { |
1553 public synchronized CK_INFO C_GetInfo() throws PKCS11Exception { |
1492 return super.C_GetInfo(); |
1554 return super.C_GetInfo(); |
1493 } |
1555 } |
1494 |
1556 |
1495 public synchronized long[] C_GetSlotList(boolean tokenPresent) throws PKCS11Exception { |
1557 public synchronized long[] C_GetSlotList(boolean tokenPresent) |
1558 throws PKCS11Exception { |
|
1496 return super.C_GetSlotList(tokenPresent); |
1559 return super.C_GetSlotList(tokenPresent); |
1497 } |
1560 } |
1498 |
1561 |
1499 public synchronized CK_SLOT_INFO C_GetSlotInfo(long slotID) throws PKCS11Exception { |
1562 public synchronized CK_SLOT_INFO C_GetSlotInfo(long slotID) |
1563 throws PKCS11Exception { |
|
1500 return super.C_GetSlotInfo(slotID); |
1564 return super.C_GetSlotInfo(slotID); |
1501 } |
1565 } |
1502 |
1566 |
1503 public synchronized CK_TOKEN_INFO C_GetTokenInfo(long slotID) throws PKCS11Exception { |
1567 public synchronized CK_TOKEN_INFO C_GetTokenInfo(long slotID) |
1568 throws PKCS11Exception { |
|
1504 return super.C_GetTokenInfo(slotID); |
1569 return super.C_GetTokenInfo(slotID); |
1505 } |
1570 } |
1506 |
1571 |
1507 public synchronized long[] C_GetMechanismList(long slotID) throws PKCS11Exception { |
1572 public synchronized long[] C_GetMechanismList(long slotID) |
1573 throws PKCS11Exception { |
|
1508 return super.C_GetMechanismList(slotID); |
1574 return super.C_GetMechanismList(slotID); |
1509 } |
1575 } |
1510 |
1576 |
1511 public synchronized CK_MECHANISM_INFO C_GetMechanismInfo(long slotID, long type) throws PKCS11Exception { |
1577 public synchronized CK_MECHANISM_INFO C_GetMechanismInfo(long slotID, |
1578 long type) throws PKCS11Exception { |
|
1512 return super.C_GetMechanismInfo(slotID, type); |
1579 return super.C_GetMechanismInfo(slotID, type); |
1513 } |
1580 } |
1514 |
1581 |
1515 public synchronized long C_OpenSession(long slotID, long flags, Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception { |
1582 public synchronized long C_OpenSession(long slotID, long flags, |
1583 Object pApplication, CK_NOTIFY Notify) throws PKCS11Exception { |
|
1516 return super.C_OpenSession(slotID, flags, pApplication, Notify); |
1584 return super.C_OpenSession(slotID, flags, pApplication, Notify); |
1517 } |
1585 } |
1518 |
1586 |
1519 public synchronized void C_CloseSession(long hSession) throws PKCS11Exception { |
1587 public synchronized void C_CloseSession(long hSession) |
1588 throws PKCS11Exception { |
|
1520 super.C_CloseSession(hSession); |
1589 super.C_CloseSession(hSession); |
1521 } |
1590 } |
1522 |
1591 |
1523 public synchronized CK_SESSION_INFO C_GetSessionInfo(long hSession) throws PKCS11Exception { |
1592 public synchronized CK_SESSION_INFO C_GetSessionInfo(long hSession) |
1593 throws PKCS11Exception { |
|
1524 return super.C_GetSessionInfo(hSession); |
1594 return super.C_GetSessionInfo(hSession); |
1525 } |
1595 } |
1526 |
1596 |
1527 public synchronized void C_Login(long hSession, long userType, char[] pPin) throws PKCS11Exception { |
1597 public synchronized void C_Login(long hSession, long userType, char[] pPin) |
1598 throws PKCS11Exception { |
|
1528 super.C_Login(hSession, userType, pPin); |
1599 super.C_Login(hSession, userType, pPin); |
1529 } |
1600 } |
1530 |
1601 |
1531 public synchronized void C_Logout(long hSession) throws PKCS11Exception { |
1602 public synchronized void C_Logout(long hSession) throws PKCS11Exception { |
1532 super.C_Logout(hSession); |
1603 super.C_Logout(hSession); |
1533 } |
1604 } |
1534 |
1605 |
1535 public synchronized long C_CreateObject(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1606 public synchronized long C_CreateObject(long hSession, |
1607 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
|
1536 return super.C_CreateObject(hSession, pTemplate); |
1608 return super.C_CreateObject(hSession, pTemplate); |
1537 } |
1609 } |
1538 |
1610 |
1539 public synchronized long C_CopyObject(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1611 public synchronized long C_CopyObject(long hSession, long hObject, |
1612 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
|
1540 return super.C_CopyObject(hSession, hObject, pTemplate); |
1613 return super.C_CopyObject(hSession, hObject, pTemplate); |
1541 } |
1614 } |
1542 |
1615 |
1543 public synchronized void C_DestroyObject(long hSession, long hObject) throws PKCS11Exception { |
1616 public synchronized void C_DestroyObject(long hSession, long hObject) |
1617 throws PKCS11Exception { |
|
1544 super.C_DestroyObject(hSession, hObject); |
1618 super.C_DestroyObject(hSession, hObject); |
1545 } |
1619 } |
1546 |
1620 |
1547 public synchronized void C_GetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1621 public synchronized void C_GetAttributeValue(long hSession, long hObject, |
1622 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
|
1548 super.C_GetAttributeValue(hSession, hObject, pTemplate); |
1623 super.C_GetAttributeValue(hSession, hObject, pTemplate); |
1549 } |
1624 } |
1550 |
1625 |
1551 public synchronized void C_SetAttributeValue(long hSession, long hObject, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1626 public synchronized void C_SetAttributeValue(long hSession, long hObject, |
1627 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
|
1552 super.C_SetAttributeValue(hSession, hObject, pTemplate); |
1628 super.C_SetAttributeValue(hSession, hObject, pTemplate); |
1553 } |
1629 } |
1554 |
1630 |
1555 public synchronized void C_FindObjectsInit(long hSession, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1631 public synchronized void C_FindObjectsInit(long hSession, |
1632 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
|
1556 super.C_FindObjectsInit(hSession, pTemplate); |
1633 super.C_FindObjectsInit(hSession, pTemplate); |
1557 } |
1634 } |
1558 |
1635 |
1559 public synchronized long[] C_FindObjects(long hSession, long ulMaxObjectCount) throws PKCS11Exception { |
1636 public synchronized long[] C_FindObjects(long hSession, |
1637 long ulMaxObjectCount) throws PKCS11Exception { |
|
1560 return super.C_FindObjects(hSession, ulMaxObjectCount); |
1638 return super.C_FindObjects(hSession, ulMaxObjectCount); |
1561 } |
1639 } |
1562 |
1640 |
1563 public synchronized void C_FindObjectsFinal(long hSession) throws PKCS11Exception { |
1641 public synchronized void C_FindObjectsFinal(long hSession) |
1642 throws PKCS11Exception { |
|
1564 super.C_FindObjectsFinal(hSession); |
1643 super.C_FindObjectsFinal(hSession); |
1565 } |
1644 } |
1566 |
1645 |
1567 public synchronized void C_EncryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
1646 public synchronized void C_EncryptInit(long hSession, |
1647 CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
|
1568 super.C_EncryptInit(hSession, pMechanism, hKey); |
1648 super.C_EncryptInit(hSession, pMechanism, hKey); |
1569 } |
1649 } |
1570 |
1650 |
1571 public synchronized int C_Encrypt(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOfs, int outLen) throws PKCS11Exception { |
1651 public synchronized int C_Encrypt(long hSession, byte[] in, int inOfs, |
1652 int inLen, byte[] out, int outOfs, int outLen) |
|
1653 throws PKCS11Exception { |
|
1572 return super.C_Encrypt(hSession, in, inOfs, inLen, out, outOfs, outLen); |
1654 return super.C_Encrypt(hSession, in, inOfs, inLen, out, outOfs, outLen); |
1573 } |
1655 } |
1574 |
1656 |
1575 public synchronized int C_EncryptUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception { |
1657 public synchronized int C_EncryptUpdate(long hSession, long directIn, |
1576 return super.C_EncryptUpdate(hSession, directIn, in, inOfs, inLen, directOut, out, outOfs, outLen); |
1658 byte[] in, int inOfs, int inLen, long directOut, byte[] out, |
1577 } |
1659 int outOfs, int outLen) throws PKCS11Exception { |
1578 |
1660 return super.C_EncryptUpdate(hSession, directIn, in, inOfs, inLen, |
1579 public synchronized int C_EncryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception { |
1661 directOut, out, outOfs, outLen); |
1662 } |
|
1663 |
|
1664 public synchronized int C_EncryptFinal(long hSession, long directOut, |
|
1665 byte[] out, int outOfs, int outLen) throws PKCS11Exception { |
|
1580 return super.C_EncryptFinal(hSession, directOut, out, outOfs, outLen); |
1666 return super.C_EncryptFinal(hSession, directOut, out, outOfs, outLen); |
1581 } |
1667 } |
1582 |
1668 |
1583 public synchronized void C_DecryptInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
1669 public synchronized void C_DecryptInit(long hSession, |
1670 CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
|
1584 super.C_DecryptInit(hSession, pMechanism, hKey); |
1671 super.C_DecryptInit(hSession, pMechanism, hKey); |
1585 } |
1672 } |
1586 |
1673 |
1587 public synchronized int C_Decrypt(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOfs, int outLen) throws PKCS11Exception { |
1674 public synchronized int C_Decrypt(long hSession, byte[] in, int inOfs, |
1675 int inLen, byte[] out, int outOfs, int outLen) |
|
1676 throws PKCS11Exception { |
|
1588 return super.C_Decrypt(hSession, in, inOfs, inLen, out, outOfs, outLen); |
1677 return super.C_Decrypt(hSession, in, inOfs, inLen, out, outOfs, outLen); |
1589 } |
1678 } |
1590 |
1679 |
1591 public synchronized int C_DecryptUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception { |
1680 public synchronized int C_DecryptUpdate(long hSession, long directIn, |
1592 return super.C_DecryptUpdate(hSession, directIn, in, inOfs, inLen, directOut, out, outOfs, outLen); |
1681 byte[] in, int inOfs, int inLen, long directOut, byte[] out, |
1593 } |
1682 int outOfs, int outLen) throws PKCS11Exception { |
1594 |
1683 return super.C_DecryptUpdate(hSession, directIn, in, inOfs, inLen, |
1595 public synchronized int C_DecryptFinal(long hSession, long directOut, byte[] out, int outOfs, int outLen) throws PKCS11Exception { |
1684 directOut, out, outOfs, outLen); |
1685 } |
|
1686 |
|
1687 public synchronized int C_DecryptFinal(long hSession, long directOut, |
|
1688 byte[] out, int outOfs, int outLen) throws PKCS11Exception { |
|
1596 return super.C_DecryptFinal(hSession, directOut, out, outOfs, outLen); |
1689 return super.C_DecryptFinal(hSession, directOut, out, outOfs, outLen); |
1597 } |
1690 } |
1598 |
1691 |
1599 public synchronized void C_DigestInit(long hSession, CK_MECHANISM pMechanism) throws PKCS11Exception { |
1692 public synchronized void C_DigestInit(long hSession, CK_MECHANISM pMechanism) |
1693 throws PKCS11Exception { |
|
1600 super.C_DigestInit(hSession, pMechanism); |
1694 super.C_DigestInit(hSession, pMechanism); |
1601 } |
1695 } |
1602 |
1696 |
1603 public synchronized int C_DigestSingle(long hSession, CK_MECHANISM pMechanism, byte[] in, int inOfs, int inLen, byte[] digest, int digestOfs, int digestLen) throws PKCS11Exception { |
1697 public synchronized int C_DigestSingle(long hSession, |
1604 return super.C_DigestSingle(hSession, pMechanism, in, inOfs, inLen, digest, digestOfs, digestLen); |
1698 CK_MECHANISM pMechanism, byte[] in, int inOfs, int inLen, |
1605 } |
1699 byte[] digest, int digestOfs, int digestLen) throws PKCS11Exception { |
1606 |
1700 return super.C_DigestSingle(hSession, pMechanism, in, inOfs, inLen, |
1607 public synchronized void C_DigestUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception { |
1701 digest, digestOfs, digestLen); |
1702 } |
|
1703 |
|
1704 public synchronized void C_DigestUpdate(long hSession, long directIn, |
|
1705 byte[] in, int inOfs, int inLen) throws PKCS11Exception { |
|
1608 super.C_DigestUpdate(hSession, directIn, in, inOfs, inLen); |
1706 super.C_DigestUpdate(hSession, directIn, in, inOfs, inLen); |
1609 } |
1707 } |
1610 |
1708 |
1611 public synchronized void C_DigestKey(long hSession, long hKey) throws PKCS11Exception { |
1709 public synchronized void C_DigestKey(long hSession, long hKey) |
1710 throws PKCS11Exception { |
|
1612 super.C_DigestKey(hSession, hKey); |
1711 super.C_DigestKey(hSession, hKey); |
1613 } |
1712 } |
1614 |
1713 |
1615 public synchronized int C_DigestFinal(long hSession, byte[] pDigest, int digestOfs, int digestLen) throws PKCS11Exception { |
1714 public synchronized int C_DigestFinal(long hSession, byte[] pDigest, |
1715 int digestOfs, int digestLen) throws PKCS11Exception { |
|
1616 return super.C_DigestFinal(hSession, pDigest, digestOfs, digestLen); |
1716 return super.C_DigestFinal(hSession, pDigest, digestOfs, digestLen); |
1617 } |
1717 } |
1618 |
1718 |
1619 public synchronized void C_SignInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
1719 public synchronized void C_SignInit(long hSession, CK_MECHANISM pMechanism, |
1720 long hKey) throws PKCS11Exception { |
|
1620 super.C_SignInit(hSession, pMechanism, hKey); |
1721 super.C_SignInit(hSession, pMechanism, hKey); |
1621 } |
1722 } |
1622 |
1723 |
1623 public synchronized byte[] C_Sign(long hSession, byte[] pData) throws PKCS11Exception { |
1724 public synchronized byte[] C_Sign(long hSession, byte[] pData) |
1725 throws PKCS11Exception { |
|
1624 return super.C_Sign(hSession, pData); |
1726 return super.C_Sign(hSession, pData); |
1625 } |
1727 } |
1626 |
1728 |
1627 public synchronized void C_SignUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception { |
1729 public synchronized void C_SignUpdate(long hSession, long directIn, |
1730 byte[] in, int inOfs, int inLen) throws PKCS11Exception { |
|
1628 super.C_SignUpdate(hSession, directIn, in, inOfs, inLen); |
1731 super.C_SignUpdate(hSession, directIn, in, inOfs, inLen); |
1629 } |
1732 } |
1630 |
1733 |
1631 public synchronized byte[] C_SignFinal(long hSession, int expectedLen) throws PKCS11Exception { |
1734 public synchronized byte[] C_SignFinal(long hSession, int expectedLen) |
1735 throws PKCS11Exception { |
|
1632 return super.C_SignFinal(hSession, expectedLen); |
1736 return super.C_SignFinal(hSession, expectedLen); |
1633 } |
1737 } |
1634 |
1738 |
1635 public synchronized void C_SignRecoverInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
1739 public synchronized void C_SignRecoverInit(long hSession, |
1740 CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
|
1636 super.C_SignRecoverInit(hSession, pMechanism, hKey); |
1741 super.C_SignRecoverInit(hSession, pMechanism, hKey); |
1637 } |
1742 } |
1638 |
1743 |
1639 public synchronized int C_SignRecover(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOufs, int outLen) throws PKCS11Exception { |
1744 public synchronized int C_SignRecover(long hSession, byte[] in, int inOfs, |
1640 return super.C_SignRecover(hSession, in, inOfs, inLen, out, outOufs, outLen); |
1745 int inLen, byte[] out, int outOufs, int outLen) |
1641 } |
1746 throws PKCS11Exception { |
1642 |
1747 return super.C_SignRecover(hSession, in, inOfs, inLen, out, outOufs, |
1643 public synchronized void C_VerifyInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
1748 outLen); |
1749 } |
|
1750 |
|
1751 public synchronized void C_VerifyInit(long hSession, CK_MECHANISM pMechanism, |
|
1752 long hKey) throws PKCS11Exception { |
|
1644 super.C_VerifyInit(hSession, pMechanism, hKey); |
1753 super.C_VerifyInit(hSession, pMechanism, hKey); |
1645 } |
1754 } |
1646 |
1755 |
1647 public synchronized void C_Verify(long hSession, byte[] pData, byte[] pSignature) throws PKCS11Exception { |
1756 public synchronized void C_Verify(long hSession, byte[] pData, |
1757 byte[] pSignature) throws PKCS11Exception { |
|
1648 super.C_Verify(hSession, pData, pSignature); |
1758 super.C_Verify(hSession, pData, pSignature); |
1649 } |
1759 } |
1650 |
1760 |
1651 public synchronized void C_VerifyUpdate(long hSession, long directIn, byte[] in, int inOfs, int inLen) throws PKCS11Exception { |
1761 public synchronized void C_VerifyUpdate(long hSession, long directIn, |
1762 byte[] in, int inOfs, int inLen) throws PKCS11Exception { |
|
1652 super.C_VerifyUpdate(hSession, directIn, in, inOfs, inLen); |
1763 super.C_VerifyUpdate(hSession, directIn, in, inOfs, inLen); |
1653 } |
1764 } |
1654 |
1765 |
1655 public synchronized void C_VerifyFinal(long hSession, byte[] pSignature) throws PKCS11Exception { |
1766 public synchronized void C_VerifyFinal(long hSession, byte[] pSignature) |
1767 throws PKCS11Exception { |
|
1656 super.C_VerifyFinal(hSession, pSignature); |
1768 super.C_VerifyFinal(hSession, pSignature); |
1657 } |
1769 } |
1658 |
1770 |
1659 public synchronized void C_VerifyRecoverInit(long hSession, CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
1771 public synchronized void C_VerifyRecoverInit(long hSession, |
1772 CK_MECHANISM pMechanism, long hKey) throws PKCS11Exception { |
|
1660 super.C_VerifyRecoverInit(hSession, pMechanism, hKey); |
1773 super.C_VerifyRecoverInit(hSession, pMechanism, hKey); |
1661 } |
1774 } |
1662 |
1775 |
1663 public synchronized int C_VerifyRecover(long hSession, byte[] in, int inOfs, int inLen, byte[] out, int outOufs, int outLen) throws PKCS11Exception { |
1776 public synchronized int C_VerifyRecover(long hSession, byte[] in, int inOfs, |
1664 return super.C_VerifyRecover(hSession, in, inOfs, inLen, out, outOufs, outLen); |
1777 int inLen, byte[] out, int outOufs, int outLen) |
1665 } |
1778 throws PKCS11Exception { |
1666 |
1779 return super.C_VerifyRecover(hSession, in, inOfs, inLen, out, outOufs, |
1667 public synchronized long C_GenerateKey(long hSession, CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1780 outLen); |
1781 } |
|
1782 |
|
1783 public synchronized long C_GenerateKey(long hSession, |
|
1784 CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pTemplate) |
|
1785 throws PKCS11Exception { |
|
1668 return super.C_GenerateKey(hSession, pMechanism, pTemplate); |
1786 return super.C_GenerateKey(hSession, pMechanism, pTemplate); |
1669 } |
1787 } |
1670 |
1788 |
1671 public synchronized long[] C_GenerateKeyPair(long hSession, |
1789 public synchronized long[] C_GenerateKeyPair(long hSession, |
1672 CK_MECHANISM pMechanism, |
1790 CK_MECHANISM pMechanism, CK_ATTRIBUTE[] pPublicKeyTemplate, |
1673 CK_ATTRIBUTE[] pPublicKeyTemplate, |
1791 CK_ATTRIBUTE[] pPrivateKeyTemplate) |
1674 CK_ATTRIBUTE[] pPrivateKeyTemplate) throws PKCS11Exception { |
1792 throws PKCS11Exception { |
1675 return super.C_GenerateKeyPair(hSession, pMechanism, pPublicKeyTemplate, pPrivateKeyTemplate); |
1793 return super.C_GenerateKeyPair(hSession, pMechanism, pPublicKeyTemplate, |
1676 } |
1794 pPrivateKeyTemplate); |
1677 |
1795 } |
1678 public synchronized byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism, long hWrappingKey, long hKey) throws PKCS11Exception { |
1796 |
1797 public synchronized byte[] C_WrapKey(long hSession, CK_MECHANISM pMechanism, |
|
1798 long hWrappingKey, long hKey) throws PKCS11Exception { |
|
1679 return super.C_WrapKey(hSession, pMechanism, hWrappingKey, hKey); |
1799 return super.C_WrapKey(hSession, pMechanism, hWrappingKey, hKey); |
1680 } |
1800 } |
1681 |
1801 |
1682 public synchronized long C_UnwrapKey(long hSession, CK_MECHANISM pMechanism, |
1802 public synchronized long C_UnwrapKey(long hSession, CK_MECHANISM pMechanism, |
1683 long hUnwrappingKey, byte[] pWrappedKey, |
1803 long hUnwrappingKey, byte[] pWrappedKey, CK_ATTRIBUTE[] pTemplate) |
1684 CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1804 throws PKCS11Exception { |
1685 return super.C_UnwrapKey(hSession, pMechanism, hUnwrappingKey, pWrappedKey, pTemplate); |
1805 return super.C_UnwrapKey(hSession, pMechanism, hUnwrappingKey, |
1806 pWrappedKey, pTemplate); |
|
1686 } |
1807 } |
1687 |
1808 |
1688 public synchronized long C_DeriveKey(long hSession, CK_MECHANISM pMechanism, |
1809 public synchronized long C_DeriveKey(long hSession, CK_MECHANISM pMechanism, |
1689 long hBaseKey, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1810 long hBaseKey, CK_ATTRIBUTE[] pTemplate) throws PKCS11Exception { |
1690 return super.C_DeriveKey(hSession, pMechanism, hBaseKey, pTemplate); |
1811 return super.C_DeriveKey(hSession, pMechanism, hBaseKey, pTemplate); |
1691 } |
1812 } |
1692 |
1813 |
1693 public synchronized void C_SeedRandom(long hSession, byte[] pSeed) throws PKCS11Exception { |
1814 public synchronized void C_SeedRandom(long hSession, byte[] pSeed) |
1815 throws PKCS11Exception { |
|
1694 super.C_SeedRandom(hSession, pSeed); |
1816 super.C_SeedRandom(hSession, pSeed); |
1695 } |
1817 } |
1696 |
1818 |
1697 public synchronized void C_GenerateRandom(long hSession, byte[] randomData) throws PKCS11Exception { |
1819 public synchronized void C_GenerateRandom(long hSession, byte[] randomData) |
1820 throws PKCS11Exception { |
|
1698 super.C_GenerateRandom(hSession, randomData); |
1821 super.C_GenerateRandom(hSession, randomData); |
1699 } |
1822 } |
1700 |
|
1701 } |
1823 } |
1702 |
|
1703 } |
1824 } |