Path: blob/master/src/jdk.crypto.cryptoki/share/native/libj2pkcs11/pkcs11f.h
41152 views
/* Copyright (c) OASIS Open 2016, 2019. All Rights Reserved./1* /Distributed under the terms of the OASIS IPR Policy,2* [http://www.oasis-open.org/policies-guidelines/ipr], AS-IS, WITHOUT ANY3* IMPLIED OR EXPRESS WARRANTY; there is no warranty of MERCHANTABILITY, FITNESS FOR A4* PARTICULAR PURPOSE or NONINFRINGEMENT of the rights of others.5*/67/* Latest version of the specification:8* http://docs.oasis-open.org/pkcs11/pkcs11-base/v2.40/pkcs11-base-v2.40.html9*/1011/* This header file contains pretty much everything about all the12* Cryptoki function prototypes. Because this information is13* used for more than just declaring function prototypes, the14* order of the functions appearing herein is important, and15* should not be altered.16*/1718/* General-purpose */1920/* C_Initialize initializes the Cryptoki library. */21CK_PKCS11_FUNCTION_INFO(C_Initialize)22#ifdef CK_NEED_ARG_LIST23(24CK_VOID_PTR pInitArgs /* if this is not NULL_PTR, it gets25* cast to CK_C_INITIALIZE_ARGS_PTR26* and dereferenced27*/28);29#endif303132/* C_Finalize indicates that an application is done with the33* Cryptoki library.34*/35CK_PKCS11_FUNCTION_INFO(C_Finalize)36#ifdef CK_NEED_ARG_LIST37(38CK_VOID_PTR pReserved /* reserved. Should be NULL_PTR */39);40#endif414243/* C_GetInfo returns general information about Cryptoki. */44CK_PKCS11_FUNCTION_INFO(C_GetInfo)45#ifdef CK_NEED_ARG_LIST46(47CK_INFO_PTR pInfo /* location that receives information */48);49#endif505152/* C_GetFunctionList returns the function list. */53CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)54#ifdef CK_NEED_ARG_LIST55(56CK_FUNCTION_LIST_PTR_PTR ppFunctionList /* receives pointer to57* function list58*/59);60#endif61626364/* Slot and token management */6566/* C_GetSlotList obtains a list of slots in the system. */67CK_PKCS11_FUNCTION_INFO(C_GetSlotList)68#ifdef CK_NEED_ARG_LIST69(70CK_BBOOL tokenPresent, /* only slots with tokens */71CK_SLOT_ID_PTR pSlotList, /* receives array of slot IDs */72CK_ULONG_PTR pulCount /* receives number of slots */73);74#endif757677/* C_GetSlotInfo obtains information about a particular slot in78* the system.79*/80CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)81#ifdef CK_NEED_ARG_LIST82(83CK_SLOT_ID slotID, /* the ID of the slot */84CK_SLOT_INFO_PTR pInfo /* receives the slot information */85);86#endif878889/* C_GetTokenInfo obtains information about a particular token90* in the system.91*/92CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)93#ifdef CK_NEED_ARG_LIST94(95CK_SLOT_ID slotID, /* ID of the token's slot */96CK_TOKEN_INFO_PTR pInfo /* receives the token information */97);98#endif99100101/* C_GetMechanismList obtains a list of mechanism types102* supported by a token.103*/104CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)105#ifdef CK_NEED_ARG_LIST106(107CK_SLOT_ID slotID, /* ID of token's slot */108CK_MECHANISM_TYPE_PTR pMechanismList, /* gets mech. array */109CK_ULONG_PTR pulCount /* gets # of mechs. */110);111#endif112113114/* C_GetMechanismInfo obtains information about a particular115* mechanism possibly supported by a token.116*/117CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)118#ifdef CK_NEED_ARG_LIST119(120CK_SLOT_ID slotID, /* ID of the token's slot */121CK_MECHANISM_TYPE type, /* type of mechanism */122CK_MECHANISM_INFO_PTR pInfo /* receives mechanism info */123);124#endif125126127/* C_InitToken initializes a token. */128CK_PKCS11_FUNCTION_INFO(C_InitToken)129#ifdef CK_NEED_ARG_LIST130(131CK_SLOT_ID slotID, /* ID of the token's slot */132CK_UTF8CHAR_PTR pPin, /* the SO's initial PIN */133CK_ULONG ulPinLen, /* length in bytes of the PIN */134CK_UTF8CHAR_PTR pLabel /* 32-byte token label (blank padded) */135);136#endif137138139/* C_InitPIN initializes the normal user's PIN. */140CK_PKCS11_FUNCTION_INFO(C_InitPIN)141#ifdef CK_NEED_ARG_LIST142(143CK_SESSION_HANDLE hSession, /* the session's handle */144CK_UTF8CHAR_PTR pPin, /* the normal user's PIN */145CK_ULONG ulPinLen /* length in bytes of the PIN */146);147#endif148149150/* C_SetPIN modifies the PIN of the user who is logged in. */151CK_PKCS11_FUNCTION_INFO(C_SetPIN)152#ifdef CK_NEED_ARG_LIST153(154CK_SESSION_HANDLE hSession, /* the session's handle */155CK_UTF8CHAR_PTR pOldPin, /* the old PIN */156CK_ULONG ulOldLen, /* length of the old PIN */157CK_UTF8CHAR_PTR pNewPin, /* the new PIN */158CK_ULONG ulNewLen /* length of the new PIN */159);160#endif161162163164/* Session management */165166/* C_OpenSession opens a session between an application and a167* token.168*/169CK_PKCS11_FUNCTION_INFO(C_OpenSession)170#ifdef CK_NEED_ARG_LIST171(172CK_SLOT_ID slotID, /* the slot's ID */173CK_FLAGS flags, /* from CK_SESSION_INFO */174CK_VOID_PTR pApplication, /* passed to callback */175CK_NOTIFY Notify, /* callback function */176CK_SESSION_HANDLE_PTR phSession /* gets session handle */177);178#endif179180181/* C_CloseSession closes a session between an application and a182* token.183*/184CK_PKCS11_FUNCTION_INFO(C_CloseSession)185#ifdef CK_NEED_ARG_LIST186(187CK_SESSION_HANDLE hSession /* the session's handle */188);189#endif190191192/* C_CloseAllSessions closes all sessions with a token. */193CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)194#ifdef CK_NEED_ARG_LIST195(196CK_SLOT_ID slotID /* the token's slot */197);198#endif199200201/* C_GetSessionInfo obtains information about the session. */202CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)203#ifdef CK_NEED_ARG_LIST204(205CK_SESSION_HANDLE hSession, /* the session's handle */206CK_SESSION_INFO_PTR pInfo /* receives session info */207);208#endif209210211/* C_GetOperationState obtains the state of the cryptographic operation212* in a session.213*/214CK_PKCS11_FUNCTION_INFO(C_GetOperationState)215#ifdef CK_NEED_ARG_LIST216(217CK_SESSION_HANDLE hSession, /* session's handle */218CK_BYTE_PTR pOperationState, /* gets state */219CK_ULONG_PTR pulOperationStateLen /* gets state length */220);221#endif222223224/* C_SetOperationState restores the state of the cryptographic225* operation in a session.226*/227CK_PKCS11_FUNCTION_INFO(C_SetOperationState)228#ifdef CK_NEED_ARG_LIST229(230CK_SESSION_HANDLE hSession, /* session's handle */231CK_BYTE_PTR pOperationState, /* holds state */232CK_ULONG ulOperationStateLen, /* holds state length */233CK_OBJECT_HANDLE hEncryptionKey, /* en/decryption key */234CK_OBJECT_HANDLE hAuthenticationKey /* sign/verify key */235);236#endif237238239/* C_Login logs a user into a token. */240CK_PKCS11_FUNCTION_INFO(C_Login)241#ifdef CK_NEED_ARG_LIST242(243CK_SESSION_HANDLE hSession, /* the session's handle */244CK_USER_TYPE userType, /* the user type */245CK_UTF8CHAR_PTR pPin, /* the user's PIN */246CK_ULONG ulPinLen /* the length of the PIN */247);248#endif249250251/* C_Logout logs a user out from a token. */252CK_PKCS11_FUNCTION_INFO(C_Logout)253#ifdef CK_NEED_ARG_LIST254(255CK_SESSION_HANDLE hSession /* the session's handle */256);257#endif258259260261/* Object management */262263/* C_CreateObject creates a new object. */264CK_PKCS11_FUNCTION_INFO(C_CreateObject)265#ifdef CK_NEED_ARG_LIST266(267CK_SESSION_HANDLE hSession, /* the session's handle */268CK_ATTRIBUTE_PTR pTemplate, /* the object's template */269CK_ULONG ulCount, /* attributes in template */270CK_OBJECT_HANDLE_PTR phObject /* gets new object's handle. */271);272#endif273274275/* C_CopyObject copies an object, creating a new object for the276* copy.277*/278CK_PKCS11_FUNCTION_INFO(C_CopyObject)279#ifdef CK_NEED_ARG_LIST280(281CK_SESSION_HANDLE hSession, /* the session's handle */282CK_OBJECT_HANDLE hObject, /* the object's handle */283CK_ATTRIBUTE_PTR pTemplate, /* template for new object */284CK_ULONG ulCount, /* attributes in template */285CK_OBJECT_HANDLE_PTR phNewObject /* receives handle of copy */286);287#endif288289290/* C_DestroyObject destroys an object. */291CK_PKCS11_FUNCTION_INFO(C_DestroyObject)292#ifdef CK_NEED_ARG_LIST293(294CK_SESSION_HANDLE hSession, /* the session's handle */295CK_OBJECT_HANDLE hObject /* the object's handle */296);297#endif298299300/* C_GetObjectSize gets the size of an object in bytes. */301CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)302#ifdef CK_NEED_ARG_LIST303(304CK_SESSION_HANDLE hSession, /* the session's handle */305CK_OBJECT_HANDLE hObject, /* the object's handle */306CK_ULONG_PTR pulSize /* receives size of object */307);308#endif309310311/* C_GetAttributeValue obtains the value of one or more object312* attributes.313*/314CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)315#ifdef CK_NEED_ARG_LIST316(317CK_SESSION_HANDLE hSession, /* the session's handle */318CK_OBJECT_HANDLE hObject, /* the object's handle */319CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs; gets vals */320CK_ULONG ulCount /* attributes in template */321);322#endif323324325/* C_SetAttributeValue modifies the value of one or more object326* attributes.327*/328CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)329#ifdef CK_NEED_ARG_LIST330(331CK_SESSION_HANDLE hSession, /* the session's handle */332CK_OBJECT_HANDLE hObject, /* the object's handle */333CK_ATTRIBUTE_PTR pTemplate, /* specifies attrs and values */334CK_ULONG ulCount /* attributes in template */335);336#endif337338339/* C_FindObjectsInit initializes a search for token and session340* objects that match a template.341*/342CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)343#ifdef CK_NEED_ARG_LIST344(345CK_SESSION_HANDLE hSession, /* the session's handle */346CK_ATTRIBUTE_PTR pTemplate, /* attribute values to match */347CK_ULONG ulCount /* attrs in search template */348);349#endif350351352/* C_FindObjects continues a search for token and session353* objects that match a template, obtaining additional object354* handles.355*/356CK_PKCS11_FUNCTION_INFO(C_FindObjects)357#ifdef CK_NEED_ARG_LIST358(359CK_SESSION_HANDLE hSession, /* session's handle */360CK_OBJECT_HANDLE_PTR phObject, /* gets obj. handles */361CK_ULONG ulMaxObjectCount, /* max handles to get */362CK_ULONG_PTR pulObjectCount /* actual # returned */363);364#endif365366367/* C_FindObjectsFinal finishes a search for token and session368* objects.369*/370CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)371#ifdef CK_NEED_ARG_LIST372(373CK_SESSION_HANDLE hSession /* the session's handle */374);375#endif376377378379/* Encryption and decryption */380381/* C_EncryptInit initializes an encryption operation. */382CK_PKCS11_FUNCTION_INFO(C_EncryptInit)383#ifdef CK_NEED_ARG_LIST384(385CK_SESSION_HANDLE hSession, /* the session's handle */386CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */387CK_OBJECT_HANDLE hKey /* handle of encryption key */388);389#endif390391392/* C_Encrypt encrypts single-part data. */393CK_PKCS11_FUNCTION_INFO(C_Encrypt)394#ifdef CK_NEED_ARG_LIST395(396CK_SESSION_HANDLE hSession, /* session's handle */397CK_BYTE_PTR pData, /* the plaintext data */398CK_ULONG ulDataLen, /* bytes of plaintext */399CK_BYTE_PTR pEncryptedData, /* gets ciphertext */400CK_ULONG_PTR pulEncryptedDataLen /* gets c-text size */401);402#endif403404405/* C_EncryptUpdate continues a multiple-part encryption406* operation.407*/408CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)409#ifdef CK_NEED_ARG_LIST410(411CK_SESSION_HANDLE hSession, /* session's handle */412CK_BYTE_PTR pPart, /* the plaintext data */413CK_ULONG ulPartLen, /* plaintext data len */414CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */415CK_ULONG_PTR pulEncryptedPartLen /* gets c-text size */416);417#endif418419420/* C_EncryptFinal finishes a multiple-part encryption421* operation.422*/423CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)424#ifdef CK_NEED_ARG_LIST425(426CK_SESSION_HANDLE hSession, /* session handle */427CK_BYTE_PTR pLastEncryptedPart, /* last c-text */428CK_ULONG_PTR pulLastEncryptedPartLen /* gets last size */429);430#endif431432433/* C_DecryptInit initializes a decryption operation. */434CK_PKCS11_FUNCTION_INFO(C_DecryptInit)435#ifdef CK_NEED_ARG_LIST436(437CK_SESSION_HANDLE hSession, /* the session's handle */438CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */439CK_OBJECT_HANDLE hKey /* handle of decryption key */440);441#endif442443444/* C_Decrypt decrypts encrypted data in a single part. */445CK_PKCS11_FUNCTION_INFO(C_Decrypt)446#ifdef CK_NEED_ARG_LIST447(448CK_SESSION_HANDLE hSession, /* session's handle */449CK_BYTE_PTR pEncryptedData, /* ciphertext */450CK_ULONG ulEncryptedDataLen, /* ciphertext length */451CK_BYTE_PTR pData, /* gets plaintext */452CK_ULONG_PTR pulDataLen /* gets p-text size */453);454#endif455456457/* C_DecryptUpdate continues a multiple-part decryption458* operation.459*/460CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)461#ifdef CK_NEED_ARG_LIST462(463CK_SESSION_HANDLE hSession, /* session's handle */464CK_BYTE_PTR pEncryptedPart, /* encrypted data */465CK_ULONG ulEncryptedPartLen, /* input length */466CK_BYTE_PTR pPart, /* gets plaintext */467CK_ULONG_PTR pulPartLen /* p-text size */468);469#endif470471472/* C_DecryptFinal finishes a multiple-part decryption473* operation.474*/475CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)476#ifdef CK_NEED_ARG_LIST477(478CK_SESSION_HANDLE hSession, /* the session's handle */479CK_BYTE_PTR pLastPart, /* gets plaintext */480CK_ULONG_PTR pulLastPartLen /* p-text size */481);482#endif483484485486/* Message digesting */487488/* C_DigestInit initializes a message-digesting operation. */489CK_PKCS11_FUNCTION_INFO(C_DigestInit)490#ifdef CK_NEED_ARG_LIST491(492CK_SESSION_HANDLE hSession, /* the session's handle */493CK_MECHANISM_PTR pMechanism /* the digesting mechanism */494);495#endif496497498/* C_Digest digests data in a single part. */499CK_PKCS11_FUNCTION_INFO(C_Digest)500#ifdef CK_NEED_ARG_LIST501(502CK_SESSION_HANDLE hSession, /* the session's handle */503CK_BYTE_PTR pData, /* data to be digested */504CK_ULONG ulDataLen, /* bytes of data to digest */505CK_BYTE_PTR pDigest, /* gets the message digest */506CK_ULONG_PTR pulDigestLen /* gets digest length */507);508#endif509510511/* C_DigestUpdate continues a multiple-part message-digesting512* operation.513*/514CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)515#ifdef CK_NEED_ARG_LIST516(517CK_SESSION_HANDLE hSession, /* the session's handle */518CK_BYTE_PTR pPart, /* data to be digested */519CK_ULONG ulPartLen /* bytes of data to be digested */520);521#endif522523524/* C_DigestKey continues a multi-part message-digesting525* operation, by digesting the value of a secret key as part of526* the data already digested.527*/528CK_PKCS11_FUNCTION_INFO(C_DigestKey)529#ifdef CK_NEED_ARG_LIST530(531CK_SESSION_HANDLE hSession, /* the session's handle */532CK_OBJECT_HANDLE hKey /* secret key to digest */533);534#endif535536537/* C_DigestFinal finishes a multiple-part message-digesting538* operation.539*/540CK_PKCS11_FUNCTION_INFO(C_DigestFinal)541#ifdef CK_NEED_ARG_LIST542(543CK_SESSION_HANDLE hSession, /* the session's handle */544CK_BYTE_PTR pDigest, /* gets the message digest */545CK_ULONG_PTR pulDigestLen /* gets byte count of digest */546);547#endif548549550551/* Signing and MACing */552553/* C_SignInit initializes a signature (private key encryption)554* operation, where the signature is (will be) an appendix to555* the data, and plaintext cannot be recovered from the556* signature.557*/558CK_PKCS11_FUNCTION_INFO(C_SignInit)559#ifdef CK_NEED_ARG_LIST560(561CK_SESSION_HANDLE hSession, /* the session's handle */562CK_MECHANISM_PTR pMechanism, /* the signature mechanism */563CK_OBJECT_HANDLE hKey /* handle of signature key */564);565#endif566567568/* C_Sign signs (encrypts with private key) data in a single569* part, where the signature is (will be) an appendix to the570* data, and plaintext cannot be recovered from the signature.571*/572CK_PKCS11_FUNCTION_INFO(C_Sign)573#ifdef CK_NEED_ARG_LIST574(575CK_SESSION_HANDLE hSession, /* the session's handle */576CK_BYTE_PTR pData, /* the data to sign */577CK_ULONG ulDataLen, /* count of bytes to sign */578CK_BYTE_PTR pSignature, /* gets the signature */579CK_ULONG_PTR pulSignatureLen /* gets signature length */580);581#endif582583584/* C_SignUpdate continues a multiple-part signature operation,585* where the signature is (will be) an appendix to the data,586* and plaintext cannot be recovered from the signature.587*/588CK_PKCS11_FUNCTION_INFO(C_SignUpdate)589#ifdef CK_NEED_ARG_LIST590(591CK_SESSION_HANDLE hSession, /* the session's handle */592CK_BYTE_PTR pPart, /* the data to sign */593CK_ULONG ulPartLen /* count of bytes to sign */594);595#endif596597598/* C_SignFinal finishes a multiple-part signature operation,599* returning the signature.600*/601CK_PKCS11_FUNCTION_INFO(C_SignFinal)602#ifdef CK_NEED_ARG_LIST603(604CK_SESSION_HANDLE hSession, /* the session's handle */605CK_BYTE_PTR pSignature, /* gets the signature */606CK_ULONG_PTR pulSignatureLen /* gets signature length */607);608#endif609610611/* C_SignRecoverInit initializes a signature operation, where612* the data can be recovered from the signature.613*/614CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)615#ifdef CK_NEED_ARG_LIST616(617CK_SESSION_HANDLE hSession, /* the session's handle */618CK_MECHANISM_PTR pMechanism, /* the signature mechanism */619CK_OBJECT_HANDLE hKey /* handle of the signature key */620);621#endif622623624/* C_SignRecover signs data in a single operation, where the625* data can be recovered from the signature.626*/627CK_PKCS11_FUNCTION_INFO(C_SignRecover)628#ifdef CK_NEED_ARG_LIST629(630CK_SESSION_HANDLE hSession, /* the session's handle */631CK_BYTE_PTR pData, /* the data to sign */632CK_ULONG ulDataLen, /* count of bytes to sign */633CK_BYTE_PTR pSignature, /* gets the signature */634CK_ULONG_PTR pulSignatureLen /* gets signature length */635);636#endif637638639640/* Verifying signatures and MACs */641642/* C_VerifyInit initializes a verification operation, where the643* signature is an appendix to the data, and plaintext cannot644* cannot be recovered from the signature (e.g. DSA).645*/646CK_PKCS11_FUNCTION_INFO(C_VerifyInit)647#ifdef CK_NEED_ARG_LIST648(649CK_SESSION_HANDLE hSession, /* the session's handle */650CK_MECHANISM_PTR pMechanism, /* the verification mechanism */651CK_OBJECT_HANDLE hKey /* verification key */652);653#endif654655656/* C_Verify verifies a signature in a single-part operation,657* where the signature is an appendix to the data, and plaintext658* cannot be recovered from the signature.659*/660CK_PKCS11_FUNCTION_INFO(C_Verify)661#ifdef CK_NEED_ARG_LIST662(663CK_SESSION_HANDLE hSession, /* the session's handle */664CK_BYTE_PTR pData, /* signed data */665CK_ULONG ulDataLen, /* length of signed data */666CK_BYTE_PTR pSignature, /* signature */667CK_ULONG ulSignatureLen /* signature length*/668);669#endif670671672/* C_VerifyUpdate continues a multiple-part verification673* operation, where the signature is an appendix to the data,674* and plaintext cannot be recovered from the signature.675*/676CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)677#ifdef CK_NEED_ARG_LIST678(679CK_SESSION_HANDLE hSession, /* the session's handle */680CK_BYTE_PTR pPart, /* signed data */681CK_ULONG ulPartLen /* length of signed data */682);683#endif684685686/* C_VerifyFinal finishes a multiple-part verification687* operation, checking the signature.688*/689CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)690#ifdef CK_NEED_ARG_LIST691(692CK_SESSION_HANDLE hSession, /* the session's handle */693CK_BYTE_PTR pSignature, /* signature to verify */694CK_ULONG ulSignatureLen /* signature length */695);696#endif697698699/* C_VerifyRecoverInit initializes a signature verification700* operation, where the data is recovered from the signature.701*/702CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)703#ifdef CK_NEED_ARG_LIST704(705CK_SESSION_HANDLE hSession, /* the session's handle */706CK_MECHANISM_PTR pMechanism, /* the verification mechanism */707CK_OBJECT_HANDLE hKey /* verification key */708);709#endif710711712/* C_VerifyRecover verifies a signature in a single-part713* operation, where the data is recovered from the signature.714*/715CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)716#ifdef CK_NEED_ARG_LIST717(718CK_SESSION_HANDLE hSession, /* the session's handle */719CK_BYTE_PTR pSignature, /* signature to verify */720CK_ULONG ulSignatureLen, /* signature length */721CK_BYTE_PTR pData, /* gets signed data */722CK_ULONG_PTR pulDataLen /* gets signed data len */723);724#endif725726727728/* Dual-function cryptographic operations */729730/* C_DigestEncryptUpdate continues a multiple-part digesting731* and encryption operation.732*/733CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)734#ifdef CK_NEED_ARG_LIST735(736CK_SESSION_HANDLE hSession, /* session's handle */737CK_BYTE_PTR pPart, /* the plaintext data */738CK_ULONG ulPartLen, /* plaintext length */739CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */740CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */741);742#endif743744745/* C_DecryptDigestUpdate continues a multiple-part decryption and746* digesting operation.747*/748CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)749#ifdef CK_NEED_ARG_LIST750(751CK_SESSION_HANDLE hSession, /* session's handle */752CK_BYTE_PTR pEncryptedPart, /* ciphertext */753CK_ULONG ulEncryptedPartLen, /* ciphertext length */754CK_BYTE_PTR pPart, /* gets plaintext */755CK_ULONG_PTR pulPartLen /* gets plaintext len */756);757#endif758759760/* C_SignEncryptUpdate continues a multiple-part signing and761* encryption operation.762*/763CK_PKCS11_FUNCTION_INFO(C_SignEncryptUpdate)764#ifdef CK_NEED_ARG_LIST765(766CK_SESSION_HANDLE hSession, /* session's handle */767CK_BYTE_PTR pPart, /* the plaintext data */768CK_ULONG ulPartLen, /* plaintext length */769CK_BYTE_PTR pEncryptedPart, /* gets ciphertext */770CK_ULONG_PTR pulEncryptedPartLen /* gets c-text length */771);772#endif773774775/* C_DecryptVerifyUpdate continues a multiple-part decryption and776* verify operation.777*/778CK_PKCS11_FUNCTION_INFO(C_DecryptVerifyUpdate)779#ifdef CK_NEED_ARG_LIST780(781CK_SESSION_HANDLE hSession, /* session's handle */782CK_BYTE_PTR pEncryptedPart, /* ciphertext */783CK_ULONG ulEncryptedPartLen, /* ciphertext length */784CK_BYTE_PTR pPart, /* gets plaintext */785CK_ULONG_PTR pulPartLen /* gets p-text length */786);787#endif788789790791/* Key management */792793/* C_GenerateKey generates a secret key, creating a new key794* object.795*/796CK_PKCS11_FUNCTION_INFO(C_GenerateKey)797#ifdef CK_NEED_ARG_LIST798(799CK_SESSION_HANDLE hSession, /* the session's handle */800CK_MECHANISM_PTR pMechanism, /* key generation mech. */801CK_ATTRIBUTE_PTR pTemplate, /* template for new key */802CK_ULONG ulCount, /* # of attrs in template */803CK_OBJECT_HANDLE_PTR phKey /* gets handle of new key */804);805#endif806807808/* C_GenerateKeyPair generates a public-key/private-key pair,809* creating new key objects.810*/811CK_PKCS11_FUNCTION_INFO(C_GenerateKeyPair)812#ifdef CK_NEED_ARG_LIST813(814CK_SESSION_HANDLE hSession, /* session handle */815CK_MECHANISM_PTR pMechanism, /* key-gen mech. */816CK_ATTRIBUTE_PTR pPublicKeyTemplate, /* template for pub. key */817CK_ULONG ulPublicKeyAttributeCount, /* # pub. attrs. */818CK_ATTRIBUTE_PTR pPrivateKeyTemplate, /* template for priv. key */819CK_ULONG ulPrivateKeyAttributeCount, /* # priv. attrs. */820CK_OBJECT_HANDLE_PTR phPublicKey, /* gets pub. key handle */821CK_OBJECT_HANDLE_PTR phPrivateKey /* gets priv. key handle */822);823#endif824825826/* C_WrapKey wraps (i.e., encrypts) a key. */827CK_PKCS11_FUNCTION_INFO(C_WrapKey)828#ifdef CK_NEED_ARG_LIST829(830CK_SESSION_HANDLE hSession, /* the session's handle */831CK_MECHANISM_PTR pMechanism, /* the wrapping mechanism */832CK_OBJECT_HANDLE hWrappingKey, /* wrapping key */833CK_OBJECT_HANDLE hKey, /* key to be wrapped */834CK_BYTE_PTR pWrappedKey, /* gets wrapped key */835CK_ULONG_PTR pulWrappedKeyLen /* gets wrapped key size */836);837#endif838839840/* C_UnwrapKey unwraps (decrypts) a wrapped key, creating a new841* key object.842*/843CK_PKCS11_FUNCTION_INFO(C_UnwrapKey)844#ifdef CK_NEED_ARG_LIST845(846CK_SESSION_HANDLE hSession, /* session's handle */847CK_MECHANISM_PTR pMechanism, /* unwrapping mech. */848CK_OBJECT_HANDLE hUnwrappingKey, /* unwrapping key */849CK_BYTE_PTR pWrappedKey, /* the wrapped key */850CK_ULONG ulWrappedKeyLen, /* wrapped key len */851CK_ATTRIBUTE_PTR pTemplate, /* new key template */852CK_ULONG ulAttributeCount, /* template length */853CK_OBJECT_HANDLE_PTR phKey /* gets new handle */854);855#endif856857858/* C_DeriveKey derives a key from a base key, creating a new key859* object.860*/861CK_PKCS11_FUNCTION_INFO(C_DeriveKey)862#ifdef CK_NEED_ARG_LIST863(864CK_SESSION_HANDLE hSession, /* session's handle */865CK_MECHANISM_PTR pMechanism, /* key deriv. mech. */866CK_OBJECT_HANDLE hBaseKey, /* base key */867CK_ATTRIBUTE_PTR pTemplate, /* new key template */868CK_ULONG ulAttributeCount, /* template length */869CK_OBJECT_HANDLE_PTR phKey /* gets new handle */870);871#endif872873874875/* Random number generation */876877/* C_SeedRandom mixes additional seed material into the token's878* random number generator.879*/880CK_PKCS11_FUNCTION_INFO(C_SeedRandom)881#ifdef CK_NEED_ARG_LIST882(883CK_SESSION_HANDLE hSession, /* the session's handle */884CK_BYTE_PTR pSeed, /* the seed material */885CK_ULONG ulSeedLen /* length of seed material */886);887#endif888889890/* C_GenerateRandom generates random data. */891CK_PKCS11_FUNCTION_INFO(C_GenerateRandom)892#ifdef CK_NEED_ARG_LIST893(894CK_SESSION_HANDLE hSession, /* the session's handle */895CK_BYTE_PTR RandomData, /* receives the random data */896CK_ULONG ulRandomLen /* # of bytes to generate */897);898#endif899900901902/* Parallel function management */903904/* C_GetFunctionStatus is a legacy function; it obtains an905* updated status of a function running in parallel with an906* application.907*/908CK_PKCS11_FUNCTION_INFO(C_GetFunctionStatus)909#ifdef CK_NEED_ARG_LIST910(911CK_SESSION_HANDLE hSession /* the session's handle */912);913#endif914915916/* C_CancelFunction is a legacy function; it cancels a function917* running in parallel.918*/919CK_PKCS11_FUNCTION_INFO(C_CancelFunction)920#ifdef CK_NEED_ARG_LIST921(922CK_SESSION_HANDLE hSession /* the session's handle */923);924#endif925926927/* C_WaitForSlotEvent waits for a slot event (token insertion,928* removal, etc.) to occur.929*/930CK_PKCS11_FUNCTION_INFO(C_WaitForSlotEvent)931#ifdef CK_NEED_ARG_LIST932(933CK_FLAGS flags, /* blocking/nonblocking flag */934CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */935CK_VOID_PTR pRserved /* reserved. Should be NULL_PTR */936);937#endif938939#ifndef CK_PKCS11_2_0_ONLY940/* C_GetInterfaceList returns all the interfaces supported by the module*/941CK_PKCS11_FUNCTION_INFO(C_GetInterfaceList)942#ifdef CK_NEED_ARG_LIST943(944CK_INTERFACE_PTR pInterfacesList, /* returned interfaces */945CK_ULONG_PTR pulCount /* number of interfaces returned */946);947#endif948949/* C_GetInterface returns a specific interface from the module. */950CK_PKCS11_FUNCTION_INFO(C_GetInterface)951#ifdef CK_NEED_ARG_LIST952(953CK_UTF8CHAR_PTR pInterfaceName, /* name of the interface */954CK_VERSION_PTR pVersion, /* version of the interface */955CK_INTERFACE_PTR_PTR ppInterface, /* returned interface */956CK_FLAGS flags /* flags controlling the semantics957* of the interface */958);959#endif960961CK_PKCS11_FUNCTION_INFO(C_LoginUser)962#ifdef CK_NEED_ARG_LIST963(964CK_SESSION_HANDLE hSession, /* the session's handle */965CK_USER_TYPE userType, /* the user type */966CK_UTF8CHAR_PTR pPin, /* the user's PIN */967CK_ULONG ulPinLen, /* the length of the PIN */968CK_UTF8CHAR_PTR pUsername, /* the user's name */969CK_ULONG ulUsernameLen /*the length of the user's name */970);971#endif972973CK_PKCS11_FUNCTION_INFO(C_SessionCancel)974#ifdef CK_NEED_ARG_LIST975(976CK_SESSION_HANDLE hSession, /* the session's handle */977CK_FLAGS flags /* flags control which sessions are cancelled */978);979#endif980981CK_PKCS11_FUNCTION_INFO(C_MessageEncryptInit)982#ifdef CK_NEED_ARG_LIST983(984CK_SESSION_HANDLE hSession, /* the session's handle */985CK_MECHANISM_PTR pMechanism, /* the encryption mechanism */986CK_OBJECT_HANDLE hKey /* handle of encryption key */987);988#endif989990CK_PKCS11_FUNCTION_INFO(C_EncryptMessage)991#ifdef CK_NEED_ARG_LIST992(993CK_SESSION_HANDLE hSession, /* the session's handle */994CK_VOID_PTR pParameter, /* message specific parameter */995CK_ULONG ulParameterLen, /* length of message specific parameter */996CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */997CK_ULONG ulAssociatedDataLen, /* AEAD Associated data length */998CK_BYTE_PTR pPlaintext, /* plain text */999CK_ULONG ulPlaintextLen, /* plain text length */1000CK_BYTE_PTR pCiphertext, /* gets cipher text */1001CK_ULONG_PTR pulCiphertextLen /* gets cipher text length */1002);1003#endif10041005CK_PKCS11_FUNCTION_INFO(C_EncryptMessageBegin)1006#ifdef CK_NEED_ARG_LIST1007(1008CK_SESSION_HANDLE hSession, /* the session's handle */1009CK_VOID_PTR pParameter, /* message specific parameter */1010CK_ULONG ulParameterLen, /* length of message specific parameter */1011CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */1012CK_ULONG ulAssociatedDataLen /* AEAD Associated data length */1013);1014#endif10151016CK_PKCS11_FUNCTION_INFO(C_EncryptMessageNext)1017#ifdef CK_NEED_ARG_LIST1018(1019CK_SESSION_HANDLE hSession, /* the session's handle */1020CK_VOID_PTR pParameter, /* message specific parameter */1021CK_ULONG ulParameterLen, /* length of message specific parameter */1022CK_BYTE_PTR pPlaintextPart, /* plain text */1023CK_ULONG ulPlaintextPartLen, /* plain text length */1024CK_BYTE_PTR pCiphertextPart, /* gets cipher text */1025CK_ULONG_PTR pulCiphertextPartLen, /* gets cipher text length */1026CK_FLAGS flags /* multi mode flag */1027);1028#endif10291030CK_PKCS11_FUNCTION_INFO(C_MessageEncryptFinal)1031#ifdef CK_NEED_ARG_LIST1032(1033CK_SESSION_HANDLE hSession /* the session's handle */1034);1035#endif10361037CK_PKCS11_FUNCTION_INFO(C_MessageDecryptInit)1038#ifdef CK_NEED_ARG_LIST1039(1040CK_SESSION_HANDLE hSession, /* the session's handle */1041CK_MECHANISM_PTR pMechanism, /* the decryption mechanism */1042CK_OBJECT_HANDLE hKey /* handle of decryption key */1043);1044#endif10451046CK_PKCS11_FUNCTION_INFO(C_DecryptMessage)1047#ifdef CK_NEED_ARG_LIST1048(1049CK_SESSION_HANDLE hSession, /* the session's handle */1050CK_VOID_PTR pParameter, /* message specific parameter */1051CK_ULONG ulParameterLen, /* length of message specific parameter */1052CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */1053CK_ULONG ulAssociatedDataLen, /* AEAD Associated data length */1054CK_BYTE_PTR pCiphertext, /* cipher text */1055CK_ULONG ulCiphertextLen, /* cipher text length */1056CK_BYTE_PTR pPlaintext, /* gets plain text */1057CK_ULONG_PTR pulPlaintextLen /* gets plain text length */1058);1059#endif10601061CK_PKCS11_FUNCTION_INFO(C_DecryptMessageBegin)1062#ifdef CK_NEED_ARG_LIST1063(1064CK_SESSION_HANDLE hSession, /* the session's handle */1065CK_VOID_PTR pParameter, /* message specific parameter */1066CK_ULONG ulParameterLen, /* length of message specific parameter */1067CK_BYTE_PTR pAssociatedData, /* AEAD Associated data */1068CK_ULONG ulAssociatedDataLen /* AEAD Associated data length */1069);1070#endif10711072CK_PKCS11_FUNCTION_INFO(C_DecryptMessageNext)1073#ifdef CK_NEED_ARG_LIST1074(1075CK_SESSION_HANDLE hSession, /* the session's handle */1076CK_VOID_PTR pParameter, /* message specific parameter */1077CK_ULONG ulParameterLen, /* length of message specific parameter */1078CK_BYTE_PTR pCiphertextPart, /* cipher text */1079CK_ULONG ulCiphertextPartLen, /* cipher text length */1080CK_BYTE_PTR pPlaintextPart, /* gets plain text */1081CK_ULONG_PTR pulPlaintextPartLen, /* gets plain text length */1082CK_FLAGS flags /* multi mode flag */1083);1084#endif10851086CK_PKCS11_FUNCTION_INFO(C_MessageDecryptFinal)1087#ifdef CK_NEED_ARG_LIST1088(1089CK_SESSION_HANDLE hSession /* the session's handle */1090);1091#endif10921093CK_PKCS11_FUNCTION_INFO(C_MessageSignInit)1094#ifdef CK_NEED_ARG_LIST1095(1096CK_SESSION_HANDLE hSession, /* the session's handle */1097CK_MECHANISM_PTR pMechanism, /* the signing mechanism */1098CK_OBJECT_HANDLE hKey /* handle of signing key */1099);1100#endif11011102CK_PKCS11_FUNCTION_INFO(C_SignMessage)1103#ifdef CK_NEED_ARG_LIST1104(1105CK_SESSION_HANDLE hSession, /* the session's handle */1106CK_VOID_PTR pParameter, /* message specific parameter */1107CK_ULONG ulParameterLen, /* length of message specific parameter */1108CK_BYTE_PTR pData, /* data to sign */1109CK_ULONG ulDataLen, /* data to sign length */1110CK_BYTE_PTR pSignature, /* gets signature */1111CK_ULONG_PTR pulSignatureLen /* gets signature length */1112);1113#endif11141115CK_PKCS11_FUNCTION_INFO(C_SignMessageBegin)1116#ifdef CK_NEED_ARG_LIST1117(1118CK_SESSION_HANDLE hSession, /* the session's handle */1119CK_VOID_PTR pParameter, /* message specific parameter */1120CK_ULONG ulParameterLen /* length of message specific parameter */1121);1122#endif11231124CK_PKCS11_FUNCTION_INFO(C_SignMessageNext)1125#ifdef CK_NEED_ARG_LIST1126(1127CK_SESSION_HANDLE hSession, /* the session's handle */1128CK_VOID_PTR pParameter, /* message specific parameter */1129CK_ULONG ulParameterLen, /* length of message specific parameter */1130CK_BYTE_PTR pData, /* data to sign */1131CK_ULONG ulDataLen, /* data to sign length */1132CK_BYTE_PTR pSignature, /* gets signature */1133CK_ULONG_PTR pulSignatureLen /* gets signature length */1134);1135#endif11361137CK_PKCS11_FUNCTION_INFO(C_MessageSignFinal)1138#ifdef CK_NEED_ARG_LIST1139(1140CK_SESSION_HANDLE hSession /* the session's handle */1141);1142#endif11431144CK_PKCS11_FUNCTION_INFO(C_MessageVerifyInit)1145#ifdef CK_NEED_ARG_LIST1146(1147CK_SESSION_HANDLE hSession, /* the session's handle */1148CK_MECHANISM_PTR pMechanism, /* the signing mechanism */1149CK_OBJECT_HANDLE hKey /* handle of signing key */1150);1151#endif11521153CK_PKCS11_FUNCTION_INFO(C_VerifyMessage)1154#ifdef CK_NEED_ARG_LIST1155(1156CK_SESSION_HANDLE hSession, /* the session's handle */1157CK_VOID_PTR pParameter, /* message specific parameter */1158CK_ULONG ulParameterLen, /* length of message specific parameter */1159CK_BYTE_PTR pData, /* data to sign */1160CK_ULONG ulDataLen, /* data to sign length */1161CK_BYTE_PTR pSignature, /* signature */1162CK_ULONG ulSignatureLen /* signature length */1163);1164#endif11651166CK_PKCS11_FUNCTION_INFO(C_VerifyMessageBegin)1167#ifdef CK_NEED_ARG_LIST1168(1169CK_SESSION_HANDLE hSession, /* the session's handle */1170CK_VOID_PTR pParameter, /* message specific parameter */1171CK_ULONG ulParameterLen /* length of message specific parameter */1172);1173#endif11741175CK_PKCS11_FUNCTION_INFO(C_VerifyMessageNext)1176#ifdef CK_NEED_ARG_LIST1177(1178CK_SESSION_HANDLE hSession, /* the session's handle */1179CK_VOID_PTR pParameter, /* message specific parameter */1180CK_ULONG ulParameterLen, /* length of message specific parameter */1181CK_BYTE_PTR pData, /* data to sign */1182CK_ULONG ulDataLen, /* data to sign length */1183CK_BYTE_PTR pSignature, /* signature */1184CK_ULONG ulSignatureLen /* signature length */1185);1186#endif11871188CK_PKCS11_FUNCTION_INFO(C_MessageVerifyFinal)1189#ifdef CK_NEED_ARG_LIST1190(1191CK_SESSION_HANDLE hSession /* the session's handle */1192);1193#endif11941195#endif /* CK_PKCS11_2_0_ONLY */1196119711981199