Back to index

lightning-sunbird  0.9+nobinonly
pkcs11f.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * RSA Security INC.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 /*
00037  * Copyright (C) 1994-1999 RSA Security Inc. Licence to copy this document
00038  * is granted provided that it is identified as "RSA Security In.c Public-Key
00039  * Cryptography Standards (PKCS)" in all material mentioning or referencing
00040  * this document.
00041  */
00042 /* This function contains pretty much everything about all the */
00043 /* PKCS #11  function prototypes.  Because this information is */
00044 /* used for more than just declaring function prototypes, the */
00045 /* order of the functions appearing herein is important, and */
00046 /* should not be altered. */
00047 
00048 
00049 
00050 /* General-purpose */
00051 
00052 /* C_Initialize initializes the PKCS #11 library. */
00053 CK_PKCS11_FUNCTION_INFO(C_Initialize)
00054 #ifdef CK_NEED_ARG_LIST
00055 (
00056   CK_VOID_PTR   pInitArgs  /* if this is not NULL_PTR, it gets
00057                             * cast to CK_C_INITIALIZE_ARGS_PTR
00058                             * and dereferenced */
00059 );
00060 #endif
00061 
00062 
00063 /* C_Finalize indicates that an application is done with the
00064  * PKCS #11 library. */
00065 CK_PKCS11_FUNCTION_INFO(C_Finalize)
00066 #ifdef CK_NEED_ARG_LIST
00067 (
00068   CK_VOID_PTR   pReserved  /* reserved.  Should be NULL_PTR */
00069 );
00070 #endif
00071 
00072 
00073 /* C_GetInfo returns general information about PKCS #11. */
00074 CK_PKCS11_FUNCTION_INFO(C_GetInfo)
00075 #ifdef CK_NEED_ARG_LIST
00076 (
00077   CK_INFO_PTR   pInfo  /* location that receives information */
00078 );
00079 #endif
00080 
00081 
00082 /* C_GetFunctionList returns the function list. */
00083 CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
00084 #ifdef CK_NEED_ARG_LIST
00085 (
00086   CK_FUNCTION_LIST_PTR_PTR ppFunctionList  /* receives pointer to
00087                                             * function list */
00088 );
00089 #endif
00090 
00091 
00092 
00093 /* Slot and token management */
00094 
00095 /* C_GetSlotList obtains a list of slots in the system. */
00096 CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
00097 #ifdef CK_NEED_ARG_LIST
00098 (
00099   CK_BBOOL       tokenPresent,  /* only slots with tokens? */
00100   CK_SLOT_ID_PTR pSlotList,     /* receives array of slot IDs */
00101   CK_ULONG_PTR   pulCount       /* receives number of slots */
00102 );
00103 #endif
00104 
00105 
00106 /* C_GetSlotInfo obtains information about a particular slot in
00107  * the system. */
00108 CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
00109 #ifdef CK_NEED_ARG_LIST
00110 (
00111   CK_SLOT_ID       slotID,  /* the ID of the slot */
00112   CK_SLOT_INFO_PTR pInfo    /* receives the slot information */
00113 );
00114 #endif
00115 
00116 
00117 /* C_GetTokenInfo obtains information about a particular token
00118  * in the system. */
00119 CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
00120 #ifdef CK_NEED_ARG_LIST
00121 (
00122   CK_SLOT_ID        slotID,  /* ID of the token's slot */
00123   CK_TOKEN_INFO_PTR pInfo    /* receives the token information */
00124 );
00125 #endif
00126 
00127 
00128 /* C_GetMechanismList obtains a list of mechanism types
00129  * supported by a token. */
00130 CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
00131 #ifdef CK_NEED_ARG_LIST
00132 (
00133   CK_SLOT_ID            slotID,          /* ID of token's slot */
00134   CK_MECHANISM_TYPE_PTR pMechanismList,  /* gets mech. array */
00135   CK_ULONG_PTR          pulCount         /* gets # of mechs. */
00136 );
00137 #endif
00138 
00139 
00140 /* C_GetMechanismInfo obtains information about a particular
00141  * mechanism possibly supported by a token. */
00142 CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
00143 #ifdef CK_NEED_ARG_LIST
00144 (
00145   CK_SLOT_ID            slotID,  /* ID of the token's slot */
00146   CK_MECHANISM_TYPE     type,    /* type of mechanism */
00147   CK_MECHANISM_INFO_PTR pInfo    /* receives mechanism info */
00148 );
00149 #endif
00150 
00151 
00152 /* C_InitToken initializes a token. */
00153 CK_PKCS11_FUNCTION_INFO(C_InitToken)
00154 #ifdef CK_NEED_ARG_LIST
00155 /* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
00156 (
00157   CK_SLOT_ID         slotID,    /* ID of the token's slot */
00158   CK_UTF8CHAR_PTR    pPin,      /* the SO's initial PIN */
00159   CK_ULONG           ulPinLen,  /* length in bytes of the PIN */
00160   CK_UTF8CHAR_PTR    pLabel     /* 32-byte token label (blank padded) */
00161 );
00162 #endif
00163 
00164 
00165 /* C_InitPIN initializes the normal user's PIN. */
00166 CK_PKCS11_FUNCTION_INFO(C_InitPIN)
00167 #ifdef CK_NEED_ARG_LIST
00168 (
00169   CK_SESSION_HANDLE hSession,  /* the session's handle */
00170   CK_UTF8CHAR_PTR   pPin,      /* the normal user's PIN */
00171   CK_ULONG          ulPinLen   /* length in bytes of the PIN */
00172 );
00173 #endif
00174 
00175 
00176 /* C_SetPIN modifies the PIN of the user who is logged in. */
00177 CK_PKCS11_FUNCTION_INFO(C_SetPIN)
00178 #ifdef CK_NEED_ARG_LIST
00179 (
00180   CK_SESSION_HANDLE hSession,  /* the session's handle */
00181   CK_UTF8CHAR_PTR   pOldPin,   /* the old PIN */
00182   CK_ULONG          ulOldLen,  /* length of the old PIN */
00183   CK_UTF8CHAR_PTR   pNewPin,   /* the new PIN */
00184   CK_ULONG          ulNewLen   /* length of the new PIN */
00185 );
00186 #endif
00187 
00188 
00189 
00190 /* Session management */
00191 
00192 /* C_OpenSession opens a session between an application and a
00193  * token. */
00194 CK_PKCS11_FUNCTION_INFO(C_OpenSession)
00195 #ifdef CK_NEED_ARG_LIST
00196 (
00197   CK_SLOT_ID            slotID,        /* the slot's ID */
00198   CK_FLAGS              flags,         /* from CK_SESSION_INFO */
00199   CK_VOID_PTR           pApplication,  /* passed to callback */
00200   CK_NOTIFY             Notify,        /* callback function */
00201   CK_SESSION_HANDLE_PTR phSession      /* gets session handle */
00202 );
00203 #endif
00204 
00205 
00206 /* C_CloseSession closes a session between an application and a
00207  * token. */
00208 CK_PKCS11_FUNCTION_INFO(C_CloseSession)
00209 #ifdef CK_NEED_ARG_LIST
00210 (
00211   CK_SESSION_HANDLE hSession  /* the session's handle */
00212 );
00213 #endif
00214 
00215 
00216 /* C_CloseAllSessions closes all sessions with a token. */
00217 CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
00218 #ifdef CK_NEED_ARG_LIST
00219 (
00220   CK_SLOT_ID     slotID  /* the token's slot */
00221 );
00222 #endif
00223 
00224 
00225 /* C_GetSessionInfo obtains information about the session. */
00226 CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
00227 #ifdef CK_NEED_ARG_LIST
00228 (
00229   CK_SESSION_HANDLE   hSession,  /* the session's handle */
00230   CK_SESSION_INFO_PTR pInfo      /* receives session info */
00231 );
00232 #endif
00233 
00234 
00235 /* C_GetOperationState obtains the state of the cryptographic operation
00236  * in a session. */
00237 CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
00238 #ifdef CK_NEED_ARG_LIST
00239 (
00240   CK_SESSION_HANDLE hSession,             /* session's handle */
00241   CK_BYTE_PTR       pOperationState,      /* gets state */
00242   CK_ULONG_PTR      pulOperationStateLen  /* gets state length */
00243 );
00244 #endif
00245 
00246 
00247 /* C_SetOperationState restores the state of the cryptographic
00248  * operation in a session. */
00249 CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
00250 #ifdef CK_NEED_ARG_LIST
00251 (
00252   CK_SESSION_HANDLE hSession,            /* session's handle */
00253   CK_BYTE_PTR      pOperationState,      /* holds state */
00254   CK_ULONG         ulOperationStateLen,  /* holds state length */
00255   CK_OBJECT_HANDLE hEncryptionKey,       /* en/decryption key */
00256   CK_OBJECT_HANDLE hAuthenticationKey    /* sign/verify key */
00257 );
00258 #endif
00259 
00260 
00261 /* C_Login logs a user into a token. */
00262 CK_PKCS11_FUNCTION_INFO(C_Login)
00263 #ifdef CK_NEED_ARG_LIST
00264 (
00265   CK_SESSION_HANDLE hSession,  /* the session's handle */
00266   CK_USER_TYPE      userType,  /* the user type */
00267   CK_UTF8CHAR_PTR   pPin,      /* the user's PIN */
00268   CK_ULONG          ulPinLen   /* the length of the PIN */
00269 );
00270 #endif
00271 
00272 
00273 /* C_Logout logs a user out from a token. */
00274 CK_PKCS11_FUNCTION_INFO(C_Logout)
00275 #ifdef CK_NEED_ARG_LIST
00276 (
00277   CK_SESSION_HANDLE hSession  /* the session's handle */
00278 );
00279 #endif
00280 
00281 
00282 
00283 /* Object management */
00284 
00285 /* C_CreateObject creates a new object. */
00286 CK_PKCS11_FUNCTION_INFO(C_CreateObject)
00287 #ifdef CK_NEED_ARG_LIST
00288 (
00289   CK_SESSION_HANDLE hSession,    /* the session's handle */
00290   CK_ATTRIBUTE_PTR  pTemplate,   /* the object's template */
00291   CK_ULONG          ulCount,     /* attributes in template */
00292   CK_OBJECT_HANDLE_PTR phObject  /* gets new object's handle. */
00293 );
00294 #endif
00295 
00296 
00297 /* C_CopyObject copies an object, creating a new object for the
00298  * copy. */
00299 CK_PKCS11_FUNCTION_INFO(C_CopyObject)
00300 #ifdef CK_NEED_ARG_LIST
00301 (
00302   CK_SESSION_HANDLE    hSession,    /* the session's handle */
00303   CK_OBJECT_HANDLE     hObject,     /* the object's handle */
00304   CK_ATTRIBUTE_PTR     pTemplate,   /* template for new object */
00305   CK_ULONG             ulCount,     /* attributes in template */
00306   CK_OBJECT_HANDLE_PTR phNewObject  /* receives handle of copy */
00307 );
00308 #endif
00309 
00310 
00311 /* C_DestroyObject destroys an object. */
00312 CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
00313 #ifdef CK_NEED_ARG_LIST
00314 (
00315   CK_SESSION_HANDLE hSession,  /* the session's handle */
00316   CK_OBJECT_HANDLE  hObject    /* the object's handle */
00317 );
00318 #endif
00319 
00320 
00321 /* C_GetObjectSize gets the size of an object in bytes. */
00322 CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
00323 #ifdef CK_NEED_ARG_LIST
00324 (
00325   CK_SESSION_HANDLE hSession,  /* the session's handle */
00326   CK_OBJECT_HANDLE  hObject,   /* the object's handle */
00327   CK_ULONG_PTR      pulSize    /* receives size of object */
00328 );
00329 #endif
00330 
00331 
00332 /* C_GetAttributeValue obtains the value of one or more object
00333  * attributes. */
00334 CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
00335 #ifdef CK_NEED_ARG_LIST
00336 (
00337   CK_SESSION_HANDLE hSession,   /* the session's handle */
00338   CK_OBJECT_HANDLE  hObject,    /* the object's handle */
00339   CK_ATTRIBUTE_PTR  pTemplate,  /* specifies attrs; gets vals */
00340   CK_ULONG          ulCount     /* attributes in template */
00341 );
00342 #endif
00343 
00344 
00345 /* C_SetAttributeValue modifies the value of one or more object
00346  * attributes */
00347 CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
00348 #ifdef CK_NEED_ARG_LIST
00349 (
00350   CK_SESSION_HANDLE hSession,   /* the session's handle */
00351   CK_OBJECT_HANDLE  hObject,    /* the object's handle */
00352   CK_ATTRIBUTE_PTR  pTemplate,  /* specifies attrs and values */
00353   CK_ULONG          ulCount     /* attributes in template */
00354 );
00355 #endif
00356 
00357 
00358 /* C_FindObjectsInit initializes a search for token and session
00359  * objects that match a template. */
00360 CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
00361 #ifdef CK_NEED_ARG_LIST
00362 (
00363   CK_SESSION_HANDLE hSession,   /* the session's handle */
00364   CK_ATTRIBUTE_PTR  pTemplate,  /* attribute values to match */
00365   CK_ULONG          ulCount     /* attrs in search template */
00366 );
00367 #endif
00368 
00369 
00370 /* C_FindObjects continues a search for token and session
00371  * objects that match a template, obtaining additional object
00372  * handles. */
00373 CK_PKCS11_FUNCTION_INFO(C_FindObjects)
00374 #ifdef CK_NEED_ARG_LIST
00375 (
00376  CK_SESSION_HANDLE    hSession,          /* session's handle */
00377  CK_OBJECT_HANDLE_PTR phObject,          /* gets obj. handles */
00378  CK_ULONG             ulMaxObjectCount,  /* max handles to get */
00379  CK_ULONG_PTR         pulObjectCount     /* actual # returned */
00380 );
00381 #endif
00382 
00383 
00384 /* C_FindObjectsFinal finishes a search for token and session
00385  * objects. */
00386 CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
00387 #ifdef CK_NEED_ARG_LIST
00388 (
00389   CK_SESSION_HANDLE hSession  /* the session's handle */
00390 );
00391 #endif
00392 
00393 
00394 
00395 /* Encryption and decryption */
00396 
00397 /* C_EncryptInit initializes an encryption operation. */
00398 CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
00399 #ifdef CK_NEED_ARG_LIST
00400 (
00401   CK_SESSION_HANDLE hSession,    /* the session's handle */
00402   CK_MECHANISM_PTR  pMechanism,  /* the encryption mechanism */
00403   CK_OBJECT_HANDLE  hKey         /* handle of encryption key */
00404 );
00405 #endif
00406 
00407 
00408 /* C_Encrypt encrypts single-part data. */
00409 CK_PKCS11_FUNCTION_INFO(C_Encrypt)
00410 #ifdef CK_NEED_ARG_LIST
00411 (
00412   CK_SESSION_HANDLE hSession,            /* session's handle */
00413   CK_BYTE_PTR       pData,               /* the plaintext data */
00414   CK_ULONG          ulDataLen,           /* bytes of plaintext */
00415   CK_BYTE_PTR       pEncryptedData,      /* gets ciphertext */
00416   CK_ULONG_PTR      pulEncryptedDataLen  /* gets c-text size */
00417 );
00418 #endif
00419 
00420 
00421 /* C_EncryptUpdate continues a multiple-part encryption
00422  * operation. */
00423 CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
00424 #ifdef CK_NEED_ARG_LIST
00425 (
00426   CK_SESSION_HANDLE hSession,           /* session's handle */
00427   CK_BYTE_PTR       pPart,              /* the plaintext data */
00428   CK_ULONG          ulPartLen,          /* plaintext data len */
00429   CK_BYTE_PTR       pEncryptedPart,     /* gets ciphertext */
00430   CK_ULONG_PTR      pulEncryptedPartLen /* gets c-text size */
00431 );
00432 #endif
00433 
00434 
00435 /* C_EncryptFinal finishes a multiple-part encryption
00436  * operation. */
00437 CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
00438 #ifdef CK_NEED_ARG_LIST
00439 (
00440   CK_SESSION_HANDLE hSession,                /* session handle */
00441   CK_BYTE_PTR       pLastEncryptedPart,      /* last c-text */
00442   CK_ULONG_PTR      pulLastEncryptedPartLen  /* gets last size */
00443 );
00444 #endif
00445 
00446 
00447 /* C_DecryptInit initializes a decryption operation. */
00448 CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
00449 #ifdef CK_NEED_ARG_LIST
00450 (
00451   CK_SESSION_HANDLE hSession,    /* the session's handle */
00452   CK_MECHANISM_PTR  pMechanism,  /* the decryption mechanism */
00453   CK_OBJECT_HANDLE  hKey         /* handle of decryption key */
00454 );
00455 #endif
00456 
00457 
00458 /* C_Decrypt decrypts encrypted data in a single part. */
00459 CK_PKCS11_FUNCTION_INFO(C_Decrypt)
00460 #ifdef CK_NEED_ARG_LIST
00461 (
00462   CK_SESSION_HANDLE hSession,           /* session's handle */
00463   CK_BYTE_PTR       pEncryptedData,     /* ciphertext */
00464   CK_ULONG          ulEncryptedDataLen, /* ciphertext length */
00465   CK_BYTE_PTR       pData,              /* gets plaintext */
00466   CK_ULONG_PTR      pulDataLen          /* gets p-text size */
00467 );
00468 #endif
00469 
00470 
00471 /* C_DecryptUpdate continues a multiple-part decryption
00472  * operation. */
00473 CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
00474 #ifdef CK_NEED_ARG_LIST
00475 (
00476   CK_SESSION_HANDLE hSession,            /* session's handle */
00477   CK_BYTE_PTR       pEncryptedPart,      /* encrypted data */
00478   CK_ULONG          ulEncryptedPartLen,  /* input length */
00479   CK_BYTE_PTR       pPart,               /* gets plaintext */
00480   CK_ULONG_PTR      pulPartLen           /* p-text size */
00481 );
00482 #endif
00483 
00484 
00485 /* C_DecryptFinal finishes a multiple-part decryption
00486  * operation. */
00487 CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
00488 #ifdef CK_NEED_ARG_LIST
00489 (
00490   CK_SESSION_HANDLE hSession,       /* the session's handle */
00491   CK_BYTE_PTR       pLastPart,      /* gets plaintext */
00492   CK_ULONG_PTR      pulLastPartLen  /* p-text size */
00493 );
00494 #endif
00495 
00496 
00497 
00498 /* Message digesting */
00499 
00500 /* C_DigestInit initializes a message-digesting operation. */
00501 CK_PKCS11_FUNCTION_INFO(C_DigestInit)
00502 #ifdef CK_NEED_ARG_LIST
00503 (
00504   CK_SESSION_HANDLE hSession,   /* the session's handle */
00505   CK_MECHANISM_PTR  pMechanism  /* the digesting mechanism */
00506 );
00507 #endif
00508 
00509 
00510 /* C_Digest digests data in a single part. */
00511 CK_PKCS11_FUNCTION_INFO(C_Digest)
00512 #ifdef CK_NEED_ARG_LIST
00513 (
00514   CK_SESSION_HANDLE hSession,     /* the session's handle */
00515   CK_BYTE_PTR       pData,        /* data to be digested */
00516   CK_ULONG          ulDataLen,    /* bytes of data to digest */
00517   CK_BYTE_PTR       pDigest,      /* gets the message digest */
00518   CK_ULONG_PTR      pulDigestLen  /* gets digest length */
00519 );
00520 #endif
00521 
00522 
00523 /* C_DigestUpdate continues a multiple-part message-digesting
00524  * operation. */
00525 CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
00526 #ifdef CK_NEED_ARG_LIST
00527 (
00528   CK_SESSION_HANDLE hSession,  /* the session's handle */
00529   CK_BYTE_PTR       pPart,     /* data to be digested */
00530   CK_ULONG          ulPartLen  /* bytes of data to be digested */
00531 );
00532 #endif
00533 
00534 
00535 /* C_DigestKey continues a multi-part message-digesting
00536  * operation, by digesting the value of a secret key as part of
00537  * the data already digested. */
00538 CK_PKCS11_FUNCTION_INFO(C_DigestKey)
00539 #ifdef CK_NEED_ARG_LIST
00540 (
00541   CK_SESSION_HANDLE hSession,  /* the session's handle */
00542   CK_OBJECT_HANDLE  hKey       /* secret key to digest */
00543 );
00544 #endif
00545 
00546 
00547 /* C_DigestFinal finishes a multiple-part message-digesting
00548  * operation. */
00549 CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
00550 #ifdef CK_NEED_ARG_LIST
00551 (
00552   CK_SESSION_HANDLE hSession,     /* the session's handle */
00553   CK_BYTE_PTR       pDigest,      /* gets the message digest */
00554   CK_ULONG_PTR      pulDigestLen  /* gets byte count of digest */
00555 );
00556 #endif
00557 
00558 
00559 
00560 /* Signing and MACing */
00561 
00562 /* C_SignInit initializes a signature (private key encryption)
00563  * operation, where the signature is (will be) an appendix to
00564  * the data, and plaintext cannot be recovered from the
00565  *signature. */
00566 CK_PKCS11_FUNCTION_INFO(C_SignInit)
00567 #ifdef CK_NEED_ARG_LIST
00568 (
00569   CK_SESSION_HANDLE hSession,    /* the session's handle */
00570   CK_MECHANISM_PTR  pMechanism,  /* the signature mechanism */
00571   CK_OBJECT_HANDLE  hKey         /* handle of signature key */
00572 );
00573 #endif
00574 
00575 
00576 /* C_Sign signs (encrypts with private key) data in a single
00577  * part, where the signature is (will be) an appendix to the
00578  * data, and plaintext cannot be recovered from the signature. */
00579 CK_PKCS11_FUNCTION_INFO(C_Sign)
00580 #ifdef CK_NEED_ARG_LIST
00581 (
00582   CK_SESSION_HANDLE hSession,        /* the session's handle */
00583   CK_BYTE_PTR       pData,           /* the data to sign */
00584   CK_ULONG          ulDataLen,       /* count of bytes to sign */
00585   CK_BYTE_PTR       pSignature,      /* gets the signature */
00586   CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
00587 );
00588 #endif
00589 
00590 
00591 /* C_SignUpdate continues a multiple-part signature operation,
00592  * where the signature is (will be) an appendix to the data, 
00593  * and plaintext cannot be recovered from the signature. */
00594 CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
00595 #ifdef CK_NEED_ARG_LIST
00596 (
00597   CK_SESSION_HANDLE hSession,  /* the session's handle */
00598   CK_BYTE_PTR       pPart,     /* the data to sign */
00599   CK_ULONG          ulPartLen  /* count of bytes to sign */
00600 );
00601 #endif
00602 
00603 
00604 /* C_SignFinal finishes a multiple-part signature operation, 
00605  * returning the signature. */
00606 CK_PKCS11_FUNCTION_INFO(C_SignFinal)
00607 #ifdef CK_NEED_ARG_LIST
00608 (
00609   CK_SESSION_HANDLE hSession,        /* the session's handle */
00610   CK_BYTE_PTR       pSignature,      /* gets the signature */
00611   CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
00612 );
00613 #endif
00614 
00615 
00616 /* C_SignRecoverInit initializes a signature operation, where
00617  * the data can be recovered from the signature. */
00618 CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
00619 #ifdef CK_NEED_ARG_LIST
00620 (
00621   CK_SESSION_HANDLE hSession,   /* the session's handle */
00622   CK_MECHANISM_PTR  pMechanism, /* the signature mechanism */
00623   CK_OBJECT_HANDLE  hKey        /* handle of the signature key */
00624 );
00625 #endif
00626 
00627 
00628 /* C_SignRecover signs data in a single operation, where the
00629  * data can be recovered from the signature. */
00630 CK_PKCS11_FUNCTION_INFO(C_SignRecover)
00631 #ifdef CK_NEED_ARG_LIST
00632 (
00633   CK_SESSION_HANDLE hSession,        /* the session's handle */
00634   CK_BYTE_PTR       pData,           /* the data to sign */
00635   CK_ULONG          ulDataLen,       /* count of bytes to sign */
00636   CK_BYTE_PTR       pSignature,      /* gets the signature */
00637   CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
00638 );
00639 #endif
00640 
00641 
00642 
00643 /* Verifying signatures and MACs */
00644 
00645 /* C_VerifyInit initializes a verification operation, where the
00646  * signature is an appendix to the data, and plaintext cannot
00647  *  cannot be recovered from the signature (e.g. DSA). */
00648 CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
00649 #ifdef CK_NEED_ARG_LIST
00650 (
00651   CK_SESSION_HANDLE hSession,    /* the session's handle */
00652   CK_MECHANISM_PTR  pMechanism,  /* the verification mechanism */
00653   CK_OBJECT_HANDLE  hKey         /* verification key */ 
00654 );
00655 #endif
00656 
00657 
00658 /* C_Verify verifies a signature in a single-part operation, 
00659  * where the signature is an appendix to the data, and plaintext
00660  * cannot be recovered from the signature. */
00661 CK_PKCS11_FUNCTION_INFO(C_Verify)
00662 #ifdef CK_NEED_ARG_LIST
00663 (
00664   CK_SESSION_HANDLE hSession,       /* the session's handle */
00665   CK_BYTE_PTR       pData,          /* signed data */
00666   CK_ULONG          ulDataLen,      /* length of signed data */
00667   CK_BYTE_PTR       pSignature,     /* signature */
00668   CK_ULONG          ulSignatureLen  /* signature length*/
00669 );
00670 #endif
00671 
00672 
00673 /* C_VerifyUpdate continues a multiple-part verification
00674  * operation, where the signature is an appendix to the data, 
00675  * and plaintext cannot be recovered from the signature. */
00676 CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
00677 #ifdef CK_NEED_ARG_LIST
00678 (
00679   CK_SESSION_HANDLE hSession,  /* the session's handle */
00680   CK_BYTE_PTR       pPart,     /* signed data */
00681   CK_ULONG          ulPartLen  /* length of signed data */
00682 );
00683 #endif
00684 
00685 
00686 /* C_VerifyFinal finishes a multiple-part verification
00687  * operation, checking the signature. */
00688 CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
00689 #ifdef CK_NEED_ARG_LIST
00690 (
00691   CK_SESSION_HANDLE hSession,       /* the session's handle */
00692   CK_BYTE_PTR       pSignature,     /* signature to verify */
00693   CK_ULONG          ulSignatureLen  /* signature length */
00694 );
00695 #endif
00696 
00697 
00698 /* C_VerifyRecoverInit initializes a signature verification
00699  * operation, where the data is recovered from the signature. */
00700 CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
00701 #ifdef CK_NEED_ARG_LIST
00702 (
00703   CK_SESSION_HANDLE hSession,    /* the session's handle */
00704   CK_MECHANISM_PTR  pMechanism,  /* the verification mechanism */
00705   CK_OBJECT_HANDLE  hKey         /* verification key */
00706 );
00707 #endif
00708 
00709 
00710 /* C_VerifyRecover verifies a signature in a single-part
00711  * operation, where the data is recovered from the signature. */
00712 CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
00713 #ifdef CK_NEED_ARG_LIST
00714 (
00715   CK_SESSION_HANDLE hSession,        /* the session's handle */
00716   CK_BYTE_PTR       pSignature,      /* signature to verify */
00717   CK_ULONG          ulSignatureLen,  /* signature length */
00718   CK_BYTE_PTR       pData,           /* gets signed data */
00719   CK_ULONG_PTR      pulDataLen       /* gets signed data len */
00720 );
00721 #endif
00722 
00723 
00724 
00725 /* Dual-function cryptographic operations */
00726 
00727 /* C_DigestEncryptUpdate continues a multiple-part digesting
00728  * and encryption operation. */
00729 CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
00730 #ifdef CK_NEED_ARG_LIST
00731 (
00732   CK_SESSION_HANDLE hSession,            /* session's handle */
00733   CK_BYTE_PTR       pPart,               /* the plaintext data */
00734   CK_ULONG          ulPartLen,           /* plaintext length */
00735   CK_BYTE_PTR       pEncryptedPart,      /* gets ciphertext */
00736   CK_ULONG_PTR      pulEncryptedPartLen  /* gets c-text length */
00737 );
00738 #endif
00739 
00740 
00741 /* C_DecryptDigestUpdate continues a multiple-part decryption and
00742  * digesting operation. */
00743 CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
00744 #ifdef CK_NEED_ARG_LIST
00745 (
00746   CK_SESSION_HANDLE hSession,            /* session's handle */
00747   CK_BYTE_PTR       pEncryptedPart,      /* ciphertext */
00748   CK_ULONG          ulEncryptedPartLen,  /* ciphertext length */
00749   CK_BYTE_PTR       pPart,               /* gets plaintext */
00750   CK_ULONG_PTR      pulPartLen           /* gets plaintext len */
00751 );
00752 #endif
00753 
00754 
00755 /* C_SignEncryptUpdate continues a multiple-part signing and
00756  * encryption operation. */
00757 CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)
00758 #ifdef CK_NEED_ARG_LIST
00759 (
00760   CK_SESSION_HANDLE hSession,            /* session's handle */
00761   CK_BYTE_PTR       pPart,               /* the plaintext data */
00762   CK_ULONG          ulPartLen,           /* plaintext length */
00763   CK_BYTE_PTR       pEncryptedPart,      /* gets ciphertext */
00764   CK_ULONG_PTR      pulEncryptedPartLen  /* gets c-text length */
00765 );
00766 #endif
00767 
00768 
00769 /* C_DecryptVerifyUpdate continues a multiple-part decryption and
00770  * verify operation. */
00771 CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)
00772 #ifdef CK_NEED_ARG_LIST
00773 (
00774   CK_SESSION_HANDLE hSession,            /* session's handle */
00775   CK_BYTE_PTR       pEncryptedPart,      /* ciphertext */
00776   CK_ULONG          ulEncryptedPartLen,  /* ciphertext length */
00777   CK_BYTE_PTR       pPart,               /* gets plaintext */
00778   CK_ULONG_PTR      pulPartLen           /* gets p-text length */
00779 );
00780 #endif
00781 
00782 
00783 
00784 /* Key management */
00785 
00786 /* C_GenerateKey generates a secret key, creating a new key
00787  * object. */
00788 CK_PKCS11_FUNCTION_INFO(C_GenerateKey)
00789 #ifdef CK_NEED_ARG_LIST
00790 (
00791   CK_SESSION_HANDLE    hSession,    /* the session's handle */
00792   CK_MECHANISM_PTR     pMechanism,  /* key generation mech. */
00793   CK_ATTRIBUTE_PTR     pTemplate,   /* template for new key */
00794   CK_ULONG             ulCount,     /* # of attrs in template */
00795   CK_OBJECT_HANDLE_PTR phKey        /* gets handle of new key */
00796 );
00797 #endif
00798 
00799 
00800 /* C_GenerateKeyPair generates a public-key/private-key pair, 
00801  * creating new key objects. */
00802 CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)
00803 #ifdef CK_NEED_ARG_LIST
00804 (
00805   CK_SESSION_HANDLE    hSession,                    /* session
00806                                                      * handle */
00807   CK_MECHANISM_PTR     pMechanism,                  /* key-gen
00808                                                      * mech. */
00809   CK_ATTRIBUTE_PTR     pPublicKeyTemplate,          /* template
00810                                                      * for pub.
00811                                                      * key */
00812   CK_ULONG             ulPublicKeyAttributeCount,   /* # pub.
00813                                                      * attrs. */
00814   CK_ATTRIBUTE_PTR     pPrivateKeyTemplate,         /* template
00815                                                      * for priv.
00816                                                      * key */
00817   CK_ULONG             ulPrivateKeyAttributeCount,  /* # priv.
00818                                                      * attrs. */
00819   CK_OBJECT_HANDLE_PTR phPublicKey,                 /* gets pub.
00820                                                      * key
00821                                                      * handle */
00822   CK_OBJECT_HANDLE_PTR phPrivateKey                 /* gets
00823                                                      * priv. key
00824                                                      * handle */
00825 );
00826 #endif
00827 
00828 
00829 /* C_WrapKey wraps (i.e., encrypts) a key. */
00830 CK_PKCS11_FUNCTION_INFO(C_WrapKey)
00831 #ifdef CK_NEED_ARG_LIST
00832 (
00833   CK_SESSION_HANDLE hSession,        /* the session's handle */
00834   CK_MECHANISM_PTR  pMechanism,      /* the wrapping mechanism */
00835   CK_OBJECT_HANDLE  hWrappingKey,    /* wrapping key */
00836   CK_OBJECT_HANDLE  hKey,            /* key to be wrapped */
00837   CK_BYTE_PTR       pWrappedKey,     /* gets wrapped key */
00838   CK_ULONG_PTR      pulWrappedKeyLen /* gets wrapped key size */
00839 );
00840 #endif
00841 
00842 
00843 /* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new
00844  * key object. */
00845 CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)
00846 #ifdef CK_NEED_ARG_LIST
00847 (
00848   CK_SESSION_HANDLE    hSession,          /* session's handle */
00849   CK_MECHANISM_PTR     pMechanism,        /* unwrapping mech. */
00850   CK_OBJECT_HANDLE     hUnwrappingKey,    /* unwrapping key */
00851   CK_BYTE_PTR          pWrappedKey,       /* the wrapped key */
00852   CK_ULONG             ulWrappedKeyLen,   /* wrapped key len */
00853   CK_ATTRIBUTE_PTR     pTemplate,         /* new key template */
00854   CK_ULONG             ulAttributeCount,  /* template length */
00855   CK_OBJECT_HANDLE_PTR phKey              /* gets new handle */
00856 );
00857 #endif
00858 
00859 
00860 /* C_DeriveKey derives a key from a base key, creating a new key
00861  * object. */
00862 CK_PKCS11_FUNCTION_INFO(C_DeriveKey)
00863 #ifdef CK_NEED_ARG_LIST
00864 (
00865   CK_SESSION_HANDLE    hSession,          /* session's handle */
00866   CK_MECHANISM_PTR     pMechanism,        /* key deriv. mech. */
00867   CK_OBJECT_HANDLE     hBaseKey,          /* base key */
00868   CK_ATTRIBUTE_PTR     pTemplate,         /* new key template */
00869   CK_ULONG             ulAttributeCount,  /* template length */
00870   CK_OBJECT_HANDLE_PTR phKey              /* gets new handle */
00871 );
00872 #endif
00873 
00874 
00875 
00876 /* Random number generation */
00877 
00878 /* C_SeedRandom mixes additional seed material into the token's
00879  * random number generator. */
00880 CK_PKCS11_FUNCTION_INFO(C_SeedRandom)
00881 #ifdef CK_NEED_ARG_LIST
00882 (
00883   CK_SESSION_HANDLE hSession,  /* the session's handle */
00884   CK_BYTE_PTR       pSeed,     /* the seed material */
00885   CK_ULONG          ulSeedLen  /* length of seed material */
00886 );
00887 #endif
00888 
00889 
00890 /* C_GenerateRandom generates random data. */
00891 CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)
00892 #ifdef CK_NEED_ARG_LIST
00893 (
00894   CK_SESSION_HANDLE hSession,    /* the session's handle */
00895   CK_BYTE_PTR       RandomData,  /* receives the random data */
00896   CK_ULONG          ulRandomLen  /* # of bytes to generate */
00897 );
00898 #endif
00899 
00900 
00901 
00902 /* Parallel function management */
00903 
00904 /* C_GetFunctionStatus is a legacy function; it obtains an
00905  * updated status of a function running in parallel with an
00906  * application. */
00907 CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)
00908 #ifdef CK_NEED_ARG_LIST
00909 (
00910   CK_SESSION_HANDLE hSession  /* the session's handle */
00911 );
00912 #endif
00913 
00914 
00915 /* C_CancelFunction is a legacy function; it cancels a function
00916  * running in parallel. */
00917 CK_PKCS11_FUNCTION_INFO(C_CancelFunction)
00918 #ifdef CK_NEED_ARG_LIST
00919 (
00920   CK_SESSION_HANDLE hSession  /* the session's handle */
00921 );
00922 #endif
00923 
00924 
00925 
00926 /* Functions added in for PKCS #11 Version 2.01 or later */
00927 
00928 /* C_WaitForSlotEvent waits for a slot event (token insertion,
00929  * removal, etc.) to occur. */
00930 CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)
00931 #ifdef CK_NEED_ARG_LIST
00932 (
00933   CK_FLAGS flags,        /* blocking/nonblocking flag */
00934   CK_SLOT_ID_PTR pSlot,  /* location that receives the slot ID */
00935   CK_VOID_PTR pRserved   /* reserved.  Should be NULL_PTR */
00936 );
00937 #endif