全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3847
推到 Plurk!
推到 Facebook!

關於Project Group

答題得分者是:RaynorPao
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-04-07 17:34:14 IP:61.66.xxx.xxx 未訂閱
有個問題..目前我想撰寫個DLL file並且寫個測試的AP 分別為二個project,但是在同一個group裡面此二個project分別在不同層 要怎樣讓dll那一個project include進來AP這個project咧? 不然沒辦法debug... PS:我所指的不是compiler完DLL那個project再include它的library
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-04-08 09:54:37 IP:61.231.xxx.xxx 未訂閱
用 BCB 開一個 project 時,在 Project Manager 中會出現一個最上層的 ProjectGroup1 你可以先打開 DLL 或 EXE 的 project,再由選單 Project->Add Existing Project 或是由  Project Manager 中的 ProjectGroup1 按右鍵選單的 Add Existing Project 將 EXE 或 DLL 的 project 加入即可。 加入後,BCB 會要求您另存 project group 檔,以後就開這個 project group 檔,就可以同時維護多個 EXE/DLL project 了。 在 Debug DLL 時,必需先在 project manager 中選擇該 DLL ,然後,由選單的 RUN->Paramter... 在視窗中選定 Host Application (即執行 DLL 的主程式 EXE) 即可。 之後,可以在 project manager 中選定要 Debug DLL 直接再按 RUN ,BCB 會自動執行設定的 Host application,當 Host application 載入 DLL 時,要 Debug DLL 的 Unit source 就會出現可中斷的小藍點。    沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://big5.to/吃軟也吃硬 http://coolsite.to/ushells 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-04-09 17:01:58 IP:61.66.xxx.xxx 未訂閱
感謝您幫忙解決.. 目前有另一個問題.. 就是當我將VC作成的DLL file用BCB的implib.exe這個tool轉換成的lib給BCB 用時我也將它include到我的project中了,可是卻出現了Unresolved external '_C_GetFunctionList' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\桌面\...... 這樣的錯誤,但是我用TDUMP.exe這個tool檢查了一下我轉出來的這個lib 確實有C_GetFunctionList這些function在啊...這樣的錯誤是什麼原因造成的呢?
tech_state
版主


發表:44
回覆:638
積分:641
註冊:2003-02-10

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-04-09 17:24:36 IP:61.221.xxx.xxx 未訂閱
會不會是你有另一個相同名稱的function 這樣系統就不知道你到底是要用哪一個了
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-04-09 17:34:53 IP:61.66.xxx.xxx 未訂閱
>"<..可是我check過了並沒有.. 剛我用TDUMP和impdef這些tool都用過了 內容如下 : LIBRARY NEX_CRYPTOKI.DLL EXPORTS ??0CNEX_CRYPTOKI@@QAE@XZ @69 ; ??0CNEX_CRYPTOKI@@QAE@XZ ??4CNEX_CRYPTOKI@@QAEAAV0@ABV0@@Z @70 ; ??4CNEX_CRYPTOKI@@QAEAAV0@ABV0@@Z ?fnNEX_CRYPTOKI@@YAHXZ @71 ; ?fnNEX_CRYPTOKI@@YAHXZ ?nNEX_CRYPTOKI@@3HA @72 ; ?nNEX_CRYPTOKI@@3HA C_CancelFunction @73 ; C_CancelFunction C_CloseAllSessions @74 ; C_CloseAllSessions C_CloseSession @75 ; C_CloseSession C_CopyObject @76 ; C_CopyObject C_CreateObject @77 ; C_CreateObject C_Decrypt @78 ; C_Decrypt C_DecryptDigestUpdate @79 ; C_DecryptDigestUpdate C_DecryptFinal @80 ; C_DecryptFinal C_DecryptInit @81 ; C_DecryptInit C_DecryptUpdate @82 ; C_DecryptUpdate C_DecryptVerifyUpdate @83 ; C_DecryptVerifyUpdate C_DeriveKey @84 ; C_DeriveKey C_DestroyObject @85 ; C_DestroyObject C_Digest @86 ; C_Digest C_DigestEncryptUpdate @87 ; C_DigestEncryptUpdate C_DigestFinal @88 ; C_DigestFinal C_DigestInit @89 ; C_DigestInit C_DigestKey @90 ; C_DigestKey C_DigestUpdate @91 ; C_DigestUpdate C_Encrypt @92 ; C_Encrypt C_EncryptFinal @93 ; C_EncryptFinal C_EncryptInit @94 ; C_EncryptInit C_EncryptUpdate @95 ; C_EncryptUpdate C_Finalize @96 ; C_Finalize C_FindObjects @97 ; C_FindObjects C_FindObjectsFinal @98 ; C_FindObjectsFinal C_FindObjectsInit @99 ; C_FindObjectsInit C_GenerateKey @100 ; C_GenerateKey C_GenerateKeyPair @101 ; C_GenerateKeyPair C_GenerateRandom @102 ; C_GenerateRandom C_GetAttributeValue @103 ; C_GetAttributeValue C_GetFunctionList @104 ; C_GetFunctionList C_GetFunctionStatus @105 ; C_GetFunctionStatus C_GetInfo @106 ; C_GetInfo C_GetMechanismInfo @107 ; C_GetMechanismInfo C_GetMechanismList @108 ; C_GetMechanismList C_GetObjectSize @109 ; C_GetObjectSize C_GetOperationState @110 ; C_GetOperationState C_GetSessionInfo @111 ; C_GetSessionInfo C_GetSlotInfo @112 ; C_GetSlotInfo C_GetSlotList @113 ; C_GetSlotList C_GetTokenInfo @114 ; C_GetTokenInfo C_InitPIN @115 ; C_InitPIN C_InitToken @116 ; C_InitToken C_Initialize @117 ; C_Initialize C_Login @118 ; C_Login C_Logout @119 ; C_Logout C_OpenSession @120 ; C_OpenSession C_SeedRandom @121 ; C_SeedRandom C_SetAttributeValue @122 ; C_SetAttributeValue C_SetOperationState @123 ; C_SetOperationState C_SetPIN @124 ; C_SetPIN C_Sign @125 ; C_Sign C_SignEncryptUpdate @126 ; C_SignEncryptUpdate C_SignFinal @127 ; C_SignFinal C_SignInit @128 ; C_SignInit C_SignRecover @129 ; C_SignRecover C_SignRecoverInit @130 ; C_SignRecoverInit C_SignUpdate @131 ; C_SignUpdate C_UnwrapKey @132 ; C_UnwrapKey C_Verify @133 ; C_Verify C_VerifyFinal @134 ; C_VerifyFinal C_VerifyInit @135 ; C_VerifyInit C_VerifyRecover @136 ; C_VerifyRecover C_VerifyRecoverInit @137 ; C_VerifyRecoverInit C_VerifyUpdate @138 ; C_VerifyUpdate C_WaitForSlotEvent @139 ; C_WaitForSlotEvent C_WrapKey @140 ; C_WrapKey CancelFunction @67 ; CancelFunction CloseAllSessions @15 ; CloseAllSessions CloseSession @14 ; CloseSession CopyObject @22 ; CopyObject CreateObject @21 ; CreateObject Decrypt @35 ; Decrypt DecryptDigestUpdate @56 ; DecryptDigestUpdate DecryptFinal @37 ; DecryptFinal DecryptInit @34 ; DecryptInit DecryptUpdate @36 ; DecryptUpdate DecryptVerifyUpdate @58 ; DecryptVerifyUpdate DeriveKey @63 ; DeriveKey DestroyObject @23 ; DestroyObject Digest @39 ; Digest DigestEncryptUpdate @55 ; DigestEncryptUpdate DigestFinal @42 ; DigestFinal DigestInit @38 ; DigestInit DigestKey @41 ; DigestKey DigestUpdate @40 ; DigestUpdate Encrypt @31 ; Encrypt EncryptFinal @33 ; EncryptFinal EncryptInit @30 ; EncryptInit EncryptUpdate @32 ; EncryptUpdate Finalize @2 ; Finalize FindObjects @28 ; FindObjects FindObjectsFinal @29 ; FindObjectsFinal FindObjectsInit @27 ; FindObjectsInit GenerateKey @59 ; GenerateKey GenerateKeyPair @60 ; GenerateKeyPair GenerateRandom @65 ; GenerateRandom GetAttributeValue @25 ; GetAttributeValue GetFunctionList @4 ; GetFunctionList GetFunctionStatus @66 ; GetFunctionStatus GetInfo @3 ; GetInfo GetMechanismInfo @9 ; GetMechanismInfo GetMechanismList @8 ; GetMechanismList GetObjectSize @24 ; GetObjectSize GetOperationState @17 ; GetOperationState GetSessionInfo @16 ; GetSessionInfo GetSlotInfo @6 ; GetSlotInfo GetSlotList @5 ; GetSlotList GetTokenInfo @7 ; GetTokenInfo InitPIN @11 ; InitPIN InitToken @10 ; InitToken Initialize @1 ; Initialize Login @19 ; Login Logout @20 ; Logout OpenSession @13 ; OpenSession SeedRandom @64 ; SeedRandom SetAttributeValue @26 ; SetAttributeValue SetOperationState @18 ; SetOperationState SetPIN @12 ; SetPIN Sign @44 ; Sign SignEncryptUpdate @57 ; SignEncryptUpdate SignFinal @46 ; SignFinal SignInit @43 ; SignInit SignRecover @48 ; SignRecover SignRecoverInit @47 ; SignRecoverInit SignUpdate @45 ; SignUpdate UnwrapKey @62 ; UnwrapKey Verify @50 ; Verify VerifyFinal @52 ; VerifyFinal VerifyInit @49 ; VerifyInit VerifyRecover @54 ; VerifyRecover VerifyRecoverInit @53 ; VerifyRecoverInit VerifyUpdate @51 ; VerifyUpdate WaitForSlotEvent @68 ; WaitForSlotEvent WrapKey @61 ; WrapKey 看起來都並沒有什麼問題!仍然找不出問題所在!
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-04-09 18:10:48 IP:61.231.xxx.xxx 未訂閱
如果您有 VC 的原始碼,請試著採用 __stdcall 如下:    void __stdcall C_GetFunctionList(void);    這樣,到 BCB 中才不會多底線。另外您應該有使用 extern "C" 吧,如下:    extern "C" { ... DLL 函式宣告 ... };        沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://big5.to/吃軟也吃硬 http://coolsite.to/ushells 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-04-10 09:44:18 IP:61.66.xxx.xxx 未訂閱
我check過了VC的source code了.. CK_RV _stdcall GetFunctionList ( CK_FUNCTION_LIST_PTR_PTR ppFunctionList ) { return C_GetFunctionList ( ppFunctionList ) ; }; 在裡面都有宣告 __stdcall ... so...仍然沒辦法~~ 還是我用動態直接call DLL的file不再include它的lib這樣的方式可行嗎?
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-04-11 12:11:05 IP:61.231.xxx.xxx 未訂閱
方便將 code 上傳嗎? 因為... 以目前的資料來看,應該是不會有問題才對...    沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://big5.to/吃軟也吃硬 http://coolsite.to/ushells 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-04-11 17:37:23 IP:61.66.xxx.xxx 未訂閱
我只能post部分的code因為這是公司的東西,不太方便!    以下這部分是我自己的DLL要包我同事用VC寫的DLL 在專案方面我將VC的DLL以implib轉成lib加入到Project裡了 我以TDUMP將function列出來看都沒問題! 我以HINSTANCE Loadlibrary()動態直接call DLL的方式 也試過了..一樣的錯誤!    
//---------------------------------------------------------------------------
#include 
#include "cryptoki.h"
#include "wincard-proxy.h"    //---------------------------------------------------------------------------
extern "C" __declspec(dllexport) int __stdcall ICCFormatCard(SCARDHANDLE hCardHandle);
extern "C" __declspec(dllexport) int __stdcall GetCardSerialNumber(SCARDHANDLE hCardHandle,unsigned char **serialNumber,int *serialNumberLen);
extern "C" __declspec(dllexport) int __stdcall VerifyUserPIN(SCARDHANDLE hCardHandle,unsigned char *pinCode);
extern "C" __declspec(dllexport) int __stdcall VerifyAdminPIN(SCARDHANDLE hCardHandle,unsigned char *pinCode);
extern "C" __declspec(dllexport) int __stdcall ChangePIN(SCARDHANDLE hCardHandle,int keyID,unsigned char *currentPIN,unsigned char *newPIN);
extern "C" __declspec(dllexport) int __stdcall UnblockPIN(SCARDHANDLE hCardHandle,unsigned char *unblockPIN,unsigned char *newPIN);
extern "C" __declspec(dllexport) int __stdcall ReadSmartCardID(SCARDHANDLE hCardHandle,unsigned char **smartCardID);
extern "C" __declspec(dllexport) int __stdcall UpdateSmartCardID(SCARDHANDLE hCardHandle,unsigned char *smartCardID);
extern "C" __declspec(dllexport) int __stdcall ReadPublicKey(SCARDHANDLE hCardHandle,int certID,unsigned char *n,unsigned char *e);
extern "C" __declspec(dllexport) int __stdcall ReadCertificate(SCARDHANDLE hCardHandle,int certID,unsigned char **certificate);
extern "C" __declspec(dllexport) int __stdcall UpdateCertificate(SCARDHANDLE hCardHandle,int certID,unsigned char *certficate,int certficateLen);
extern "C" __declspec(dllexport) int __stdcall ICCSignature(SCARDHANDLE hCardHandle,int rsaKeyID,unsigned char *hashData,unsigned char **signData,int *signDataLen);
extern "C" __declspec(dllexport) int __stdcall ICCDecipher(SCARDHANDLE hCardHandle,int rsaKeyID,unsigned char *in,int in_len,unsigned char **out,int *outLen);
#pragma argsused
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fwdreason, LPVOID lpvReserved)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall ICCFormatCard(SCARDHANDLE hCardHandle)
{
 /*
 SCODE scode;
 HFILE hFile;     //open a file name scfile in the root.
 scode = ScwCreateFile(L"/scfile", NULL, &hFile);     if (FAILED(scode))
 {
  if(scode == SCW_E_FILENOTFOUND)
  {
    //the file scfile not found; create new file.
    scode = ScwCreateFile(L"/scfile", L"/s/a/default", &hFile);        if(FAILED(scode))
        //fail in creating a new file. return error code.
        return scode;
  }
  else
        //fail in opening the file. return the error code.
        return scode;
 }     //close the file
 scode = ScwCloseFile(hFile);
 //retuern the error code. if scode is SCW_S_OK, then the file is closed.
 //otherwise, it fails in closing the fail.
 return scode;
 */             CK_RV rv;
         CK_FUNCTION_LIST_PTR pFunctionList;            rv = C_GetFunctionList(&pFunctionList);            return 1;    }
//---------------------------------------------------------------------------
int __stdcall GetCardSerialNumber(SCARDHANDLE hCardHandle,unsigned char **serialNumber,int *serialNumberLen)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall VerifyUserPIN(SCARDHANDLE hCardHandle,unsigned char *pinCode)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall VerifyAdminPIN(SCARDHANDLE hCardHandle,unsigned char *pinCode)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall ChangePIN(SCARDHANDLE hCardHandle,int keyID,unsigned char *currentPIN,unsigned char *newPIN)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall UnblockPIN(SCARDHANDLE hCardHandle,unsigned char *unblockPIN,unsigned char *newPIN)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall ReadSmartCardID(SCARDHANDLE hCardHandle,unsigned char **smartCardID)
{
 SCODE scode;
 BYTE bySupportData[100];
 TUID nPrincipalUID;     //check if ScUser is authenticated
 scode = ScwIsAuthenticatedName(L"ScUser");     if(scode == SCW_S_OK)
 {
  //ScUser is currently authenticated
 }
 else if(scode == SCW_E_NOTAUTHENTICATED)
 {
  //..........      //authenticate ScUser
  scode = ScwAuthenticateName(L"ScUser",bySupportData,sizeof(bySupportData));      if(FAILED(scode))
  {
   // failed in authenticating ScUser. return error code.
   return scode;
  }
 }
 else
 {
  //other error occurred. return error code.
  return scode;
 }     //retrieve the unique identifier of ScUser.
 scode = ScwGetPrincipalUID(L"ScUser",&nPrincipalUID);     if(FAILED(scode))
 {
  //failed in retrievting the unique identifier of ScUser.
 }     return scode;    }
//---------------------------------------------------------------------------
int __stdcall UpdateSmartCardID(SCARDHANDLE hCardHandle,unsigned char *smartCardID)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall ReadPublicKey(SCARDHANDLE hCardHandle,int certID,unsigned char *n,unsigned char *e)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall ReadCertificate(SCARDHANDLE hCardHandle,int certID,unsigned char **certificate)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall UpdateCertificate(SCARDHANDLE hCardHandle,int certID,unsigned char *certficate,int certficateLen)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall ICCSignature(SCARDHANDLE hCardHandle,int rsaKeyID,unsigned char *hashData,unsigned char **signData,int *signDataLen)
{
        return 1;
}
//---------------------------------------------------------------------------
int __stdcall ICCDecipher(SCARDHANDLE hCardHandle,int rsaKeyID,unsigned char *in,int in_len,unsigned char **out,int *outLen)
{
        return 1;
}
//---------------------------------------------------------------------------
#pragma warn -pck
 
以下是我同事部分的VC code
// NEX_CRYPTOKI.cpp : Defines the entry point for the DLL application.
//    #include "stdafx.h"    #ifndef  NEXCRYPTOKI_H
#define  NEXCRYPTOKI_H "NEX_CRYPTOKI.h"
#include NEXCRYPTOKI_H
#endif     #ifndef  NEXOBJHH_H
#define  NEXOBJHH_H "nex_ObjHh.h"
#include NEXOBJHH_H
#endif     BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
                                         )
{
    switch (ul_reason_for_call)
        {
                case DLL_PROCESS_ATTACH:
                case DLL_THREAD_ATTACH:
                case DLL_THREAD_DETACH:
                case DLL_PROCESS_DETACH:
                        break;
    }
    return TRUE;
}    // This is an example of an exported variable
NEX_CRYPTOKI_API int nNEX_CRYPTOKI = 0 ;    // This is an example of an exported function.
NEX_CRYPTOKI_API int fnNEX_CRYPTOKI(void)
{
        return 42 ;
}    // This is the constructor of a class that has been exported.
// see NEX_CRYPTOKI.h for the class definition
CNEX_CRYPTOKI::CNEX_CRYPTOKI()
{ 
        return ; 
}    // == 0318 ============================================================
CK_RV _stdcall Initialize ( CK_VOID_PTR pInitArgs ) 
{
        return C_Initialize ( pInitArgs ) ;
};
CK_RV _stdcall Finalize (         CK_VOID_PTR        pReserved ) 
{
        return C_Finalize ( pReserved ) ;
};
CK_RV _stdcall GetInfo ( CK_INFO_PTR        pInfo ) 
{
        return C_GetInfo ( pInfo ) ;
};
CK_RV _stdcall GetFunctionList ( CK_FUNCTION_LIST_PTR_PTR        ppFunctionList ) 
{
        return C_GetFunctionList ( ppFunctionList ) ;
};
.....................
以下省略!
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#10 引用回覆 回覆 發表時間:2003-04-11 18:12:33 IP:61.66.xxx.xxx 未訂閱
sorry..前面post的程式片段我沒有說明的很清楚 最上面所include的"cryptoki.h"是另外再包 三個head file,總共有四個head file這四個 檔頭是RSA網站上可下載的PKCS#11所附的四個 head file!下面我附上source    "cryptoki.h"  
/* cryptoki.h include file for PKCS #11.  2001 June 25 */    /* This is a sample file containing the top level include directives
 * for building Win32 Cryptoki libraries and applications.
 */    #ifndef ___CRYPTOKI_H_INC___
#define ___CRYPTOKI_H_INC___    #pragma pack(push, cryptoki, 1)    /* Specifies that the function is a DLL entry point. */
#define CK_IMPORT_SPEC __declspec(dllimport)    /* Define CRYPTOKI_EXPORTS during the build of cryptoki libraries. Do
 * not define it in applications.
 */
#ifdef NEX_CRYPTOKI_EXPORTS //20020913 change [CRYPTOKI -> NEX_CRYPTOKI] allen
/* Specified that the function is an exported DLL entry point. */
#define CK_EXPORT_SPEC __declspec(dllexport) 
#else
#define CK_EXPORT_SPEC CK_IMPORT_SPEC 
#endif    /* Ensures the calling convention for Win32 builds */
#define CK_CALL_SPEC __cdecl    #define CK_PTR *    #define CK_DEFINE_FUNCTION(returnType, name)   returnType CK_EXPORT_SPEC CK_CALL_SPEC name    #define CK_DECLARE_FUNCTION(returnType, name)   returnType CK_EXPORT_SPEC CK_CALL_SPEC name    #define CK_DECLARE_FUNCTION_POINTER(returnType, name)   returnType CK_IMPORT_SPEC (CK_CALL_SPEC CK_PTR name)    #define CK_CALLBACK_FUNCTION(returnType, name)   returnType (CK_CALL_SPEC CK_PTR name)    #ifndef NULL_PTR
#define NULL_PTR 0
#endif    #include "pkcs11.h"    #pragma pack(pop, cryptoki)    #endif /* ___CRYPTOKI_H_INC___ */     
"pkcs11.h"
/* pkcs11.h include file for PKCS #11.  2001 June 25 */    #ifndef _PKCS11_H_
#define _PKCS11_H_ 1    #ifdef __cplusplus
extern "C" {
#endif    /* Before including this file (pkcs11.h) (or pkcs11t.h by
 * itself), 6 platform-specific macros must be defined.  These
 * macros are described below, and typical definitions for them
 * are also given.  Be advised that these definitions can depend
 * on both the platform and the compiler used (and possibly also
 * on whether a Cryptoki library is linked statically or
 * dynamically).
 *
 * In addition to defining these 6 macros, the packing convention
 * for Cryptoki structures should be set.  The Cryptoki
 * convention on packing is that structures should be 1-byte
 * aligned.
 *
 * If you're using Microsoft Developer Studio 5.0 to produce
 * Win32 stuff, this might be done by using the following
 * preprocessor directive before including pkcs11.h or pkcs11t.h:
 *
 * #pragma pack(push, cryptoki, 1)
 *
 * and using the following preprocessor directive after including
 * pkcs11.h or pkcs11t.h:
 *
 * #pragma pack(pop, cryptoki)
 *
 * If you're using an earlier version of Microsoft Developer
 * Studio to produce Win16 stuff, this might be done by using
 * the following preprocessor directive before including
 * pkcs11.h or pkcs11t.h:
 *
 * #pragma pack(1)
 *
 * In a UNIX environment, you're on your own for this.  You might
 * not need to do (or be able to do!) anything.
 *
 *
 * Now for the macros:
 *
 *
 * 1. CK_PTR: The indirection string for making a pointer to an
 * object.  It can be used like this:
 *
 * typedef CK_BYTE CK_PTR CK_BYTE_PTR;
 *
 * If you're using Microsoft Developer Studio 5.0 to produce
 * Win32 stuff, it might be defined by:
 *
 * #define CK_PTR *
 *
 * If you're using an earlier version of Microsoft Developer
 * Studio to produce Win16 stuff, it might be defined by:
 *
 * #define CK_PTR far *
 *
 * In a typical UNIX environment, it might be defined by:
 *
 * #define CK_PTR *
 *
 *
 * 2. CK_DEFINE_FUNCTION(returnType, name): A macro which makes
 * an exportable Cryptoki library function definition out of a
 * return type and a function name.  It should be used in the
 * following fashion to define the exposed Cryptoki functions in
 * a Cryptoki library:
 *
 * CK_DEFINE_FUNCTION(CK_RV, C_Initialize)(
 *   CK_VOID_PTR pReserved
 * )
 * {
 *   ...
 * }
 *
 * If you're using Microsoft Developer Studio 5.0 to define a
 * function in a Win32 Cryptoki .dll, it might be defined by:
 *
 * #define CK_DEFINE_FUNCTION(returnType, name)  *   returnType __declspec(dllexport) name
 *
 * If you're using an earlier version of Microsoft Developer
 * Studio to define a function in a Win16 Cryptoki .dll, it
 * might be defined by:
 *
 * #define CK_DEFINE_FUNCTION(returnType, name)  *   returnType __export _far _pascal name
 *
 * In a UNIX environment, it might be defined by:
 *
 * #define CK_DEFINE_FUNCTION(returnType, name)  *   returnType name
 *
 *
 * 3. CK_DECLARE_FUNCTION(returnType, name): A macro which makes
 * an importable Cryptoki library function declaration out of a
 * return type and a function name.  It should be used in the
 * following fashion:
 *
 * extern CK_DECLARE_FUNCTION(CK_RV, C_Initialize)(
 *   CK_VOID_PTR pReserved
 * );
 *
 * If you're using Microsoft Developer Studio 5.0 to declare a
 * function in a Win32 Cryptoki .dll, it might be defined by:
 *
 * #define CK_DECLARE_FUNCTION(returnType, name)  *   returnType __declspec(dllimport) name
 *
 * If you're using an earlier version of Microsoft Developer
 * Studio to declare a function in a Win16 Cryptoki .dll, it
 * might be defined by:
 *
 * #define CK_DECLARE_FUNCTION(returnType, name)  *   returnType __export _far _pascal name
 *
 * In a UNIX environment, it might be defined by:
 *
 * #define CK_DECLARE_FUNCTION(returnType, name)  *   returnType name
 *
 *
 * 4. CK_DECLARE_FUNCTION_POINTER(returnType, name): A macro
 * which makes a Cryptoki API function pointer declaration or
 * function pointer type declaration out of a return type and a
 * function name.  It should be used in the following fashion:
 *
 * // Define funcPtr to be a pointer to a Cryptoki API function
 * // taking arguments args and returning CK_RV.
 * CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtr)(args);
 *
 * or
 *
 * // Define funcPtrType to be the type of a pointer to a
 * // Cryptoki API function taking arguments args and returning
 * // CK_RV, and then define funcPtr to be a variable of type
 * // funcPtrType.
 * typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, funcPtrType)(args);
 * funcPtrType funcPtr;
 *
 * If you're using Microsoft Developer Studio 5.0 to access
 * functions in a Win32 Cryptoki .dll, in might be defined by:
 *
 * #define CK_DECLARE_FUNCTION_POINTER(returnType, name)  *   returnType __declspec(dllimport) (* name)
 *
 * If you're using an earlier version of Microsoft Developer
 * Studio to access functions in a Win16 Cryptoki .dll, it might
 * be defined by:
 *
 * #define CK_DECLARE_FUNCTION_POINTER(returnType, name)  *   returnType __export _far _pascal (* name)
 *
 * In a UNIX environment, it might be defined by:
 *
 * #define CK_DECLARE_FUNCTION_POINTER(returnType, name)  *   returnType (* name)
 *
 *
 * 5. CK_CALLBACK_FUNCTION(returnType, name): A macro which makes
 * a function pointer type for an application callback out of
 * a return type for the callback and a name for the callback.
 * It should be used in the following fashion:
 *
 * CK_CALLBACK_FUNCTION(CK_RV, myCallback)(args);
 *
 * to declare a function pointer, myCallback, to a callback
 * which takes arguments args and returns a CK_RV.  It can also
 * be used like this:
 *
 * typedef CK_CALLBACK_FUNCTION(CK_RV, myCallbackType)(args);
 * myCallbackType myCallback;
 *
 * If you're using Microsoft Developer Studio 5.0 to do Win32
 * Cryptoki development, it might be defined by:
 *
 * #define CK_CALLBACK_FUNCTION(returnType, name)  *   returnType (* name)
 *
 * If you're using an earlier version of Microsoft Developer
 * Studio to do Win16 development, it might be defined by:
 *
 * #define CK_CALLBACK_FUNCTION(returnType, name)  *   returnType _far _pascal (* name)
 *
 * In a UNIX environment, it might be defined by:
 *
 * #define CK_CALLBACK_FUNCTION(returnType, name)  *   returnType (* name)
 *
 *
 * 6. NULL_PTR: This macro is the value of a NULL pointer.
 *
 * In any ANSI/ISO C environment (and in many others as well),
 * this should best be defined by
 *
 * #ifndef NULL_PTR
 * #define NULL_PTR 0
 * #endif
 */    /* All the various Cryptoki types and #define'd values are in the
 * file pkcs11t.h. */
#include "pkcs11t.h"    #define __PASTE(x,y)      x##y    /* ==============================================================
 * Define the "extern" form of all the entry points.
 * ==============================================================
 */    #define CK_NEED_ARG_LIST  1
#define CK_PKCS11_FUNCTION_INFO(name)   extern CK_DECLARE_FUNCTION(CK_RV, name)    /* pkcs11f.h has all the information about the Cryptoki
 * function prototypes. */
#include "pkcs11f.h"    #undef CK_NEED_ARG_LIST
#undef CK_PKCS11_FUNCTION_INFO    /* ==============================================================
 * Define the typedef form of all the entry points.  That is, for
 * each Cryptoki function C_XXX, define a type CK_C_XXX which is
 * a pointer to that kind of function.
 * ==============================================================
 */    #define CK_NEED_ARG_LIST  1
#define CK_PKCS11_FUNCTION_INFO(name)   typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))    /* pkcs11f.h has all the information about the Cryptoki
 * function prototypes. */
#include "pkcs11f.h"    #undef CK_NEED_ARG_LIST
#undef CK_PKCS11_FUNCTION_INFO    /* ==============================================================
 * Define structed vector of entry points.  A CK_FUNCTION_LIST
 * contains a CK_VERSION indicating a library's Cryptoki version
 * and then a whole slew of function pointers to the routines in
 * the library.  This type was declared, but not defined, in
 * pkcs11t.h.
 * ==============================================================
 */    #define CK_PKCS11_FUNCTION_INFO(name)   __PASTE(CK_,name) name;
  
struct CK_FUNCTION_LIST {      CK_VERSION    version;  /* Cryptoki version */    /* Pile all the function pointers into the CK_FUNCTION_LIST. */
/* pkcs11f.h has all the information about the Cryptoki
 * function prototypes. */
#include "pkcs11f.h"    };    #undef CK_PKCS11_FUNCTION_INFO    #undef __PASTE    #ifdef __cplusplus
}
#endif    #endif     
"pkcs11f.h"
 
/* pkcs11f.h include file for PKCS #11.  2001 June 25 */    /* This function contains pretty much everything about all the */
/* Cryptoki function prototypes.  Because this information is */
/* used for more than just declaring function prototypes, the */
/* order of the functions appearing herein is important, and */
/* should not be altered. */        /* General-purpose */    /* C_Initialize initializes the Cryptoki library. */
CK_PKCS11_FUNCTION_INFO(C_Initialize)
#ifdef CK_NEED_ARG_LIST
(
  CK_VOID_PTR   pInitArgs  /* if this is not NULL_PTR, it gets
                            * cast to CK_C_INITIALIZE_ARGS_PTR
                            * and dereferenced */
);
#endif    /* C_Finalize indicates that an application is done with the
 * Cryptoki library. */
CK_PKCS11_FUNCTION_INFO(C_Finalize)
#ifdef CK_NEED_ARG_LIST
(
  CK_VOID_PTR   pReserved  /* reserved.  Should be NULL_PTR */
);
#endif    /* C_GetInfo returns general information about Cryptoki. */
CK_PKCS11_FUNCTION_INFO(C_GetInfo)
#ifdef CK_NEED_ARG_LIST
(
  CK_INFO_PTR   pInfo  /* location that receives information */
);
#endif    /* C_GetFunctionList returns the function list. */
CK_PKCS11_FUNCTION_INFO(C_GetFunctionList)
#ifdef CK_NEED_ARG_LIST
(
  CK_FUNCTION_LIST_PTR_PTR ppFunctionList  /* receives pointer to
                                            * function list */
);
#endif        /* Slot and token management */    /* C_GetSlotList obtains a list of slots in the system. */
CK_PKCS11_FUNCTION_INFO(C_GetSlotList)
#ifdef CK_NEED_ARG_LIST
(
  CK_BBOOL       tokenPresent,  /* only slots with tokens? */
  CK_SLOT_ID_PTR pSlotList,     /* receives array of slot IDs */
  CK_ULONG_PTR   pulCount       /* receives number of slots */
);
#endif    /* C_GetSlotInfo obtains information about a particular slot in
 * the system. */
CK_PKCS11_FUNCTION_INFO(C_GetSlotInfo)
#ifdef CK_NEED_ARG_LIST
(
  CK_SLOT_ID       slotID,  /* the ID of the slot */
  CK_SLOT_INFO_PTR pInfo    /* receives the slot information */
);
#endif    /* C_GetTokenInfo obtains information about a particular token
 * in the system. */
CK_PKCS11_FUNCTION_INFO(C_GetTokenInfo)
#ifdef CK_NEED_ARG_LIST
(
  CK_SLOT_ID        slotID,  /* ID of the token's slot */
  CK_TOKEN_INFO_PTR pInfo    /* receives the token information */
);
#endif    /* C_GetMechanismList obtains a list of mechanism types
 * supported by a token. */
CK_PKCS11_FUNCTION_INFO(C_GetMechanismList)
#ifdef CK_NEED_ARG_LIST
(
  CK_SLOT_ID            slotID,          /* ID of token's slot */
  CK_MECHANISM_TYPE_PTR pMechanismList,  /* gets mech. array */
  CK_ULONG_PTR          pulCount         /* gets # of mechs. */
);
#endif    /* C_GetMechanismInfo obtains information about a particular
 * mechanism possibly supported by a token. */
CK_PKCS11_FUNCTION_INFO(C_GetMechanismInfo)
#ifdef CK_NEED_ARG_LIST
(
  CK_SLOT_ID            slotID,  /* ID of the token's slot */
  CK_MECHANISM_TYPE     type,    /* type of mechanism */
  CK_MECHANISM_INFO_PTR pInfo    /* receives mechanism info */
);
#endif    /* C_InitToken initializes a token. */
CK_PKCS11_FUNCTION_INFO(C_InitToken)
#ifdef CK_NEED_ARG_LIST
/* pLabel changed from CK_CHAR_PTR to CK_UTF8CHAR_PTR for v2.10 */
(
  CK_SLOT_ID      slotID,    /* ID of the token's slot */
  CK_UTF8CHAR_PTR pPin,      /* the SO's initial PIN */
  CK_ULONG        ulPinLen,  /* length in bytes of the PIN */
  CK_UTF8CHAR_PTR pLabel     /* 32-byte token label (blank padded) */
);
#endif    /* C_InitPIN initializes the normal user's PIN. */
CK_PKCS11_FUNCTION_INFO(C_InitPIN)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_UTF8CHAR_PTR   pPin,      /* the normal user's PIN */
  CK_ULONG          ulPinLen   /* length in bytes of the PIN */
);
#endif    /* C_SetPIN modifies the PIN of the user who is logged in. */
CK_PKCS11_FUNCTION_INFO(C_SetPIN)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_UTF8CHAR_PTR   pOldPin,   /* the old PIN */
  CK_ULONG          ulOldLen,  /* length of the old PIN */
  CK_UTF8CHAR_PTR   pNewPin,   /* the new PIN */
  CK_ULONG          ulNewLen   /* length of the new PIN */
);
#endif        /* Session management */    /* C_OpenSession opens a session between an application and a
 * token. */
CK_PKCS11_FUNCTION_INFO(C_OpenSession)
#ifdef CK_NEED_ARG_LIST
(
  CK_SLOT_ID            slotID,        /* the slot's ID */
  CK_FLAGS              flags,         /* from CK_SESSION_INFO */
  CK_VOID_PTR           pApplication,  /* passed to callback */
  CK_NOTIFY             Notify,        /* callback function */
  CK_SESSION_HANDLE_PTR phSession      /* gets session handle */
);
#endif    /* C_CloseSession closes a session between an application and a
 * token. */
CK_PKCS11_FUNCTION_INFO(C_CloseSession)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession  /* the session's handle */
);
#endif    /* C_CloseAllSessions closes all sessions with a token. */
CK_PKCS11_FUNCTION_INFO(C_CloseAllSessions)
#ifdef CK_NEED_ARG_LIST
(
  CK_SLOT_ID     slotID  /* the token's slot */
);
#endif    /* C_GetSessionInfo obtains information about the session. */
CK_PKCS11_FUNCTION_INFO(C_GetSessionInfo)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE   hSession,  /* the session's handle */
  CK_SESSION_INFO_PTR pInfo      /* receives session info */
);
#endif    /* C_GetOperationState obtains the state of the cryptographic operation
 * in a session. */
CK_PKCS11_FUNCTION_INFO(C_GetOperationState)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,             /* session's handle */
  CK_BYTE_PTR       pOperationState,      /* gets state */
  CK_ULONG_PTR      pulOperationStateLen  /* gets state length */
);
#endif    /* C_SetOperationState restores the state of the cryptographic
 * operation in a session. */
CK_PKCS11_FUNCTION_INFO(C_SetOperationState)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,            /* session's handle */
  CK_BYTE_PTR      pOperationState,      /* holds state */
  CK_ULONG         ulOperationStateLen,  /* holds state length */
  CK_OBJECT_HANDLE hEncryptionKey,       /* en/decryption key */
  CK_OBJECT_HANDLE hAuthenticationKey    /* sign/verify key */
);
#endif    /* C_Login logs a user into a token. */
CK_PKCS11_FUNCTION_INFO(C_Login)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_USER_TYPE      userType,  /* the user type */
  CK_UTF8CHAR_PTR   pPin,      /* the user's PIN */
  CK_ULONG          ulPinLen   /* the length of the PIN */
);
#endif    /* C_Logout logs a user out from a token. */
CK_PKCS11_FUNCTION_INFO(C_Logout)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession  /* the session's handle */
);
#endif        /* Object management */    /* C_CreateObject creates a new object. */
CK_PKCS11_FUNCTION_INFO(C_CreateObject)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,    /* the session's handle */
  CK_ATTRIBUTE_PTR  pTemplate,   /* the object's template */
  CK_ULONG          ulCount,     /* attributes in template */
  CK_OBJECT_HANDLE_PTR phObject  /* gets new object's handle. */
);
#endif    /* C_CopyObject copies an object, creating a new object for the
 * copy. */
CK_PKCS11_FUNCTION_INFO(C_CopyObject)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE    hSession,    /* the session's handle */
  CK_OBJECT_HANDLE     hObject,     /* the object's handle */
  CK_ATTRIBUTE_PTR     pTemplate,   /* template for new object */
  CK_ULONG             ulCount,     /* attributes in template */
  CK_OBJECT_HANDLE_PTR phNewObject  /* receives handle of copy */
);
#endif    /* C_DestroyObject destroys an object. */
CK_PKCS11_FUNCTION_INFO(C_DestroyObject)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_OBJECT_HANDLE  hObject    /* the object's handle */
);
#endif    /* C_GetObjectSize gets the size of an object in bytes. */
CK_PKCS11_FUNCTION_INFO(C_GetObjectSize)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_OBJECT_HANDLE  hObject,   /* the object's handle */
  CK_ULONG_PTR      pulSize    /* receives size of object */
);
#endif    /* C_GetAttributeValue obtains the value of one or more object
 * attributes. */
CK_PKCS11_FUNCTION_INFO(C_GetAttributeValue)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,   /* the session's handle */
  CK_OBJECT_HANDLE  hObject,    /* the object's handle */
  CK_ATTRIBUTE_PTR  pTemplate,  /* specifies attrs; gets vals */
  CK_ULONG          ulCount     /* attributes in template */
);
#endif    /* C_SetAttributeValue modifies the value of one or more object
 * attributes */
CK_PKCS11_FUNCTION_INFO(C_SetAttributeValue)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,   /* the session's handle */
  CK_OBJECT_HANDLE  hObject,    /* the object's handle */
  CK_ATTRIBUTE_PTR  pTemplate,  /* specifies attrs and values */
  CK_ULONG          ulCount     /* attributes in template */
);
#endif    /* C_FindObjectsInit initializes a search for token and session
 * objects that match a template. */
CK_PKCS11_FUNCTION_INFO(C_FindObjectsInit)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,   /* the session's handle */
  CK_ATTRIBUTE_PTR  pTemplate,  /* attribute values to match */
  CK_ULONG          ulCount     /* attrs in search template */
);
#endif    /* C_FindObjects continues a search for token and session
 * objects that match a template, obtaining additional object
 * handles. */
CK_PKCS11_FUNCTION_INFO(C_FindObjects)
#ifdef CK_NEED_ARG_LIST
(
 CK_SESSION_HANDLE    hSession,          /* session's handle */
 CK_OBJECT_HANDLE_PTR phObject,          /* gets obj. handles */
 CK_ULONG             ulMaxObjectCount,  /* max handles to get */
 CK_ULONG_PTR         pulObjectCount     /* actual # returned */
);
#endif    /* C_FindObjectsFinal finishes a search for token and session
 * objects. */
CK_PKCS11_FUNCTION_INFO(C_FindObjectsFinal)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession  /* the session's handle */
);
#endif        /* Encryption and decryption */    /* C_EncryptInit initializes an encryption operation. */
CK_PKCS11_FUNCTION_INFO(C_EncryptInit)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,    /* the session's handle */
  CK_MECHANISM_PTR  pMechanism,  /* the encryption mechanism */
  CK_OBJECT_HANDLE  hKey         /* handle of encryption key */
);
#endif    /* C_Encrypt encrypts single-part data. */
CK_PKCS11_FUNCTION_INFO(C_Encrypt)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,            /* session's handle */
  CK_BYTE_PTR       pData,               /* the plaintext data */
  CK_ULONG          ulDataLen,           /* bytes of plaintext */
  CK_BYTE_PTR       pEncryptedData,      /* gets ciphertext */
  CK_ULONG_PTR      pulEncryptedDataLen  /* gets c-text size */
);
#endif    /* C_EncryptUpdate continues a multiple-part encryption
 * operation. */
CK_PKCS11_FUNCTION_INFO(C_EncryptUpdate)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,           /* session's handle */
  CK_BYTE_PTR       pPart,              /* the plaintext data */
  CK_ULONG          ulPartLen,          /* plaintext data len */
  CK_BYTE_PTR       pEncryptedPart,     /* gets ciphertext */
  CK_ULONG_PTR      pulEncryptedPartLen /* gets c-text size */
);
#endif    /* C_EncryptFinal finishes a multiple-part encryption
 * operation. */
CK_PKCS11_FUNCTION_INFO(C_EncryptFinal)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,                /* session handle */
  CK_BYTE_PTR       pLastEncryptedPart,      /* last c-text */
  CK_ULONG_PTR      pulLastEncryptedPartLen  /* gets last size */
);
#endif    /* C_DecryptInit initializes a decryption operation. */
CK_PKCS11_FUNCTION_INFO(C_DecryptInit)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,    /* the session's handle */
  CK_MECHANISM_PTR  pMechanism,  /* the decryption mechanism */
  CK_OBJECT_HANDLE  hKey         /* handle of decryption key */
);
#endif    /* C_Decrypt decrypts encrypted data in a single part. */
CK_PKCS11_FUNCTION_INFO(C_Decrypt)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,           /* session's handle */
  CK_BYTE_PTR       pEncryptedData,     /* ciphertext */
  CK_ULONG          ulEncryptedDataLen, /* ciphertext length */
  CK_BYTE_PTR       pData,              /* gets plaintext */
  CK_ULONG_PTR      pulDataLen          /* gets p-text size */
);
#endif    /* C_DecryptUpdate continues a multiple-part decryption
 * operation. */
CK_PKCS11_FUNCTION_INFO(C_DecryptUpdate)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,            /* session's handle */
  CK_BYTE_PTR       pEncryptedPart,      /* encrypted data */
  CK_ULONG          ulEncryptedPartLen,  /* input length */
  CK_BYTE_PTR       pPart,               /* gets plaintext */
  CK_ULONG_PTR      pulPartLen           /* p-text size */
);
#endif    /* C_DecryptFinal finishes a multiple-part decryption
 * operation. */
CK_PKCS11_FUNCTION_INFO(C_DecryptFinal)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,       /* the session's handle */
  CK_BYTE_PTR       pLastPart,      /* gets plaintext */
  CK_ULONG_PTR      pulLastPartLen  /* p-text size */
);
#endif        /* Message digesting */    /* C_DigestInit initializes a message-digesting operation. */
CK_PKCS11_FUNCTION_INFO(C_DigestInit)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,   /* the session's handle */
  CK_MECHANISM_PTR  pMechanism  /* the digesting mechanism */
);
#endif    /* C_Digest digests data in a single part. */
CK_PKCS11_FUNCTION_INFO(C_Digest)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,     /* the session's handle */
  CK_BYTE_PTR       pData,        /* data to be digested */
  CK_ULONG          ulDataLen,    /* bytes of data to digest */
  CK_BYTE_PTR       pDigest,      /* gets the message digest */
  CK_ULONG_PTR      pulDigestLen  /* gets digest length */
);
#endif    /* C_DigestUpdate continues a multiple-part message-digesting
 * operation. */
CK_PKCS11_FUNCTION_INFO(C_DigestUpdate)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_BYTE_PTR       pPart,     /* data to be digested */
  CK_ULONG          ulPartLen  /* bytes of data to be digested */
);
#endif    /* C_DigestKey continues a multi-part message-digesting
 * operation, by digesting the value of a secret key as part of
 * the data already digested. */
CK_PKCS11_FUNCTION_INFO(C_DigestKey)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_OBJECT_HANDLE  hKey       /* secret key to digest */
);
#endif    /* C_DigestFinal finishes a multiple-part message-digesting
 * operation. */
CK_PKCS11_FUNCTION_INFO(C_DigestFinal)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,     /* the session's handle */
  CK_BYTE_PTR       pDigest,      /* gets the message digest */
  CK_ULONG_PTR      pulDigestLen  /* gets byte count of digest */
);
#endif        /* Signing and MACing */    /* C_SignInit initializes a signature (private key encryption)
 * operation, where the signature is (will be) an appendix to
 * the data, and plaintext cannot be recovered from the
 *signature. */
CK_PKCS11_FUNCTION_INFO(C_SignInit)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,    /* the session's handle */
  CK_MECHANISM_PTR  pMechanism,  /* the signature mechanism */
  CK_OBJECT_HANDLE  hKey         /* handle of signature key */
);
#endif    /* C_Sign signs (encrypts with private key) data in a single
 * part, where the signature is (will be) an appendix to the
 * data, and plaintext cannot be recovered from the signature. */
CK_PKCS11_FUNCTION_INFO(C_Sign)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,        /* the session's handle */
  CK_BYTE_PTR       pData,           /* the data to sign */
  CK_ULONG          ulDataLen,       /* count of bytes to sign */
  CK_BYTE_PTR       pSignature,      /* gets the signature */
  CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
);
#endif    /* C_SignUpdate continues a multiple-part signature operation,
 * where the signature is (will be) an appendix to the data, 
 * and plaintext cannot be recovered from the signature. */
CK_PKCS11_FUNCTION_INFO(C_SignUpdate)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_BYTE_PTR       pPart,     /* the data to sign */
  CK_ULONG          ulPartLen  /* count of bytes to sign */
);
#endif    /* C_SignFinal finishes a multiple-part signature operation, 
 * returning the signature. */
CK_PKCS11_FUNCTION_INFO(C_SignFinal)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,        /* the session's handle */
  CK_BYTE_PTR       pSignature,      /* gets the signature */
  CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
);
#endif    /* C_SignRecoverInit initializes a signature operation, where
 * the data can be recovered from the signature. */
CK_PKCS11_FUNCTION_INFO(C_SignRecoverInit)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,   /* the session's handle */
  CK_MECHANISM_PTR  pMechanism, /* the signature mechanism */
  CK_OBJECT_HANDLE  hKey        /* handle of the signature key */
);
#endif    /* C_SignRecover signs data in a single operation, where the
 * data can be recovered from the signature. */
CK_PKCS11_FUNCTION_INFO(C_SignRecover)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,        /* the session's handle */
  CK_BYTE_PTR       pData,           /* the data to sign */
  CK_ULONG          ulDataLen,       /* count of bytes to sign */
  CK_BYTE_PTR       pSignature,      /* gets the signature */
  CK_ULONG_PTR      pulSignatureLen  /* gets signature length */
);
#endif        /* Verifying signatures and MACs */    /* C_VerifyInit initializes a verification operation, where the
 * signature is an appendix to the data, and plaintext cannot
 *  cannot be recovered from the signature (e.g. DSA). */
CK_PKCS11_FUNCTION_INFO(C_VerifyInit)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,    /* the session's handle */
  CK_MECHANISM_PTR  pMechanism,  /* the verification mechanism */
  CK_OBJECT_HANDLE  hKey         /* verification key */ 
);
#endif    /* C_Verify verifies a signature in a single-part operation, 
 * where the signature is an appendix to the data, and plaintext
 * cannot be recovered from the signature. */
CK_PKCS11_FUNCTION_INFO(C_Verify)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,       /* the session's handle */
  CK_BYTE_PTR       pData,          /* signed data */
  CK_ULONG          ulDataLen,      /* length of signed data */
  CK_BYTE_PTR       pSignature,     /* signature */
  CK_ULONG          ulSignatureLen  /* signature length*/
);
#endif    /* C_VerifyUpdate continues a multiple-part verification
 * operation, where the signature is an appendix to the data, 
 * and plaintext cannot be recovered from the signature. */
CK_PKCS11_FUNCTION_INFO(C_VerifyUpdate)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,  /* the session's handle */
  CK_BYTE_PTR       pPart,     /* signed data */
  CK_ULONG          ulPartLen  /* length of signed data */
);
#endif    /* C_VerifyFinal finishes a multiple-part verification
 * operation, checking the signature. */
CK_PKCS11_FUNCTION_INFO(C_VerifyFinal)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,       /* the session's handle */
  CK_BYTE_PTR       pSignature,     /* signature to verify */
  CK_ULONG          ulSignatureLen  /* signature length */
);
#endif    /* C_VerifyRecoverInit initializes a signature verification
 * operation, where the data is recovered from the signature. */
CK_PKCS11_FUNCTION_INFO(C_VerifyRecoverInit)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,    /* the session's handle */
  CK_MECHANISM_PTR  pMechanism,  /* the verification mechanism */
  CK_OBJECT_HANDLE  hKey         /* verification key */
);
#endif    /* C_VerifyRecover verifies a signature in a single-part
 * operation, where the data is recovered from the signature. */
CK_PKCS11_FUNCTION_INFO(C_VerifyRecover)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,        /* the session's handle */
  CK_BYTE_PTR       pSignature,      /* signature to verify */
  CK_ULONG          ulSignatureLen,  /* signature length */
  CK_BYTE_PTR       pData,           /* gets signed data */
  CK_ULONG_PTR      pulDataLen       /* gets signed data len */
);
#endif        /* Dual-function cryptographic operations */    /* C_DigestEncryptUpdate continues a multiple-part digesting
 * and encryption operation. */
CK_PKCS11_FUNCTION_INFO(C_DigestEncryptUpdate)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,            /* session's handle */
  CK_BYTE_PTR       pPart,               /* the plaintext data */
  CK_ULONG          ulPartLen,           /* plaintext length */
  CK_BYTE_PTR       pEncryptedPart,      /* gets ciphertext */
  CK_ULONG_PTR      pulEncryptedPartLen  /* gets c-text length */
);
#endif    /* C_DecryptDigestUpdate continues a multiple-part decryption and
 * digesting operation. */
CK_PKCS11_FUNCTION_INFO(C_DecryptDigestUpdate)
#ifdef CK_NEED_ARG_LIST
(
  CK_SESSION_HANDLE hSession,            /* session's handle */
  CK_BYTE_PTR       pEncryptedPart,      /* ciphertext */
  CK_ULONG          ulEncryptedPartLen,  /* ciphertext length */
  CK_BYTE_PTR       pPart,               /* gets plaintext */
  CK_ULONG_PTR      pulPartLen           /* gets plaintext len */
);
#endif    /* C_SignEncryptUpdate continues a multiple-part signing and
 * encryption operation. */
C
        
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#11 引用回覆 回覆 發表時間:2003-04-12 18:04:02 IP:203.204.xxx.xxx 未訂閱
引言: 我只能post部分的code因為這是公司的東西,不太方便! ...
我想,如果您不先整理一下,直接剪貼過來.... 真的很難看懂... 我建議,先將問題簡化,先另寫一個簡易的範例,將問題重現,或是說在重寫簡易範例後,可能問題就找到了。 不然,看到那麼多的 >沒空更新的網頁... href="http://big5.to/吃軟也吃硬">http://big5.to/吃軟也吃硬 http://coolsite.to/ushells 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#12 引用回覆 回覆 發表時間:2003-04-14 09:55:34 IP:61.66.xxx.xxx 未訂閱
>"<..不好意思造成困擾 我新開一個project並沒有作太多的動作 純粹將我同事VC的DLL轉成BCB的lib以及Cryptoki.h include到project中 compiler完一樣的狀況,錯誤仍然沒有改變!     
     
//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Unit1.h" #include "Cryptoki.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { CK_RV rv; CK_FUNCTION_LIST_PTR pFunctionList; rv = C_GetFunctionList(&pFunctionList); } //--------------------------------------------------------------------------- error message
 
[Linker Error] Unresolved external '_C_GetFunctionList' referenced from C:\DOCUMENTS AND SETTINGS\ADMINISTRATOR\桌面\新資料夾\UNIT1.OBJ
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#13 引用回覆 回覆 發表時間:2003-04-14 14:21:52 IP:61.231.xxx.xxx 未訂閱
引言: >"<..不好意思造成困擾 我新開一個project並沒有作太多的動作 純粹將我同事VC的DLL轉成BCB的lib以及Cryptoki.h include到project中 compiler完一樣的狀況,錯誤仍然沒有改變!
可否將簡化後的 Code (最好將 VC 也簡化,與公司機密完全無關,純粹將值傳出即可)上傳到本討論區或 email 也行... 因為您所給的資訊並不足以讓人判斷為何出錯。 沒空更新的網頁... http://dllee.ktop.com.tw C及指標教學,計算機概論,資訊管理導論... http://big5.to/吃軟也吃硬 http://coolsite.to/ushells 介紹Shells,LiteStep,GeoShell....
------
http://www.ViewMove.com
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#14 引用回覆 回覆 發表時間:2003-04-17 11:31:49 IP:203.73.xxx.xxx 未訂閱
sockman 你好: 如果我沒有說錯的話,你應該在做 PKCS11 的應用吧?? 只是我沒有辦法確定貴公司是使用 > --
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#15 引用回覆 回覆 發表時間:2003-04-17 14:28:18 IP:61.66.xxx.xxx 未訂閱
RaynorPao你好: 沒錯..我是在作PKCS#11的應用,因為我同事寫了PKCS的元件 但因為UI介面MFC我不會寫,我比較常用BCB,因此想要使用 BCB來call他的DLL file但是在轉換的過程中都無錯誤,卻在 Link時發生error,至今找不到錯誤在那,因此我現在改用VC 來寫了,其實我只是要寫個測試他那個DLL的AP,並且把它的一些 function重包成另一個DLL像是讀取憑證,簽章等的將指令簡化 ,我也想將檔案上傳讓大家幫忙一下看看問題在那裡,但這東西 因為蠻重要的,實在不太方便,我只能把RSA網站上公開的code post 出來而己!非常感謝幫忙囉,可以幫我想想還有什麼比較可能的 問題,我再來嘗試看看,暫時我還是改用VC寫吧,不然我的工作進度又 落後了..>"<..把一個問題卡在這會浪費太多時間所以我只好換個 方式了,目前我用VC來call這個DLL完全沒有問題,但是還是希望目前 我這個BCB的問題還是能夠解決,因為還是比較習慣用BCB....>"<感謝啦!
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#16 引用回覆 回覆 發表時間:2003-04-17 14:45:32 IP:203.73.xxx.xxx 未訂閱
引言: RaynorPao你好: 沒錯..我是在作PKCS#11的應用,因為我同事寫了PKCS的元件 但因為UI介面MFC我不會寫,我比較常用BCB,因此想要使用 BCB來call他的DLL file但是在轉換的過程中都無錯誤,卻在 Link時發生error,至今找不到錯誤在那,因此我現在改用VC 來寫了,其實我只是要寫個測試他那個DLL的AP,並且把它的一些 function重包成另一個DLL像是讀取憑證,簽章等的將指令簡化 ,我也想將檔案上傳讓大家幫忙一下看看問題在那裡,但這東西 因為蠻重要的,實在不太方便,我只能把RSA網站上公開的code post 出來而己!非常感謝幫忙囉,可以幫我想想還有什麼比較可能的 問題,我再來嘗試看看,暫時我還是改用VC寫吧,不然我的工作進度又 落後了..>"<..把一個問題卡在這會浪費太多時間所以我只好換個 方式了,目前我用VC來call這個DLL完全沒有問題,但是還是希望目前 我這個BCB的問題還是能夠解決,因為還是比較習慣用BCB....>"<感謝啦!
sockman 你好:
(1)根據小弟我的經驗,只要是 VC 可以使用的 DLL,在 BCB 是一定也可以使用
   的,只是看要如何使用罷了(只有一種情況是不行的,那就是如果你  >
    -- 
        
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#17 引用回覆 回覆 發表時間:2003-04-17 16:18:10 IP:61.66.xxx.xxx 未訂閱
[/quote] sockman 你好: (1)根據小弟我的經驗,只要是 VC 可以使用的 DLL,在 BCB 是一定也可以使用    的,只是看要如何使用罷了(只有一種情況是不行的,那就是如果你
sockman
一般會員


發表:24
回覆:29
積分:10
註冊:2003-03-17

發送簡訊給我
#18 引用回覆 回覆 發表時間:2003-04-18 09:28:24 IP:61.66.xxx.xxx 未訂閱
包子大哥...謝啦... 根據你所說的..用implib -a這樣的方式轉DLL 就沒問題了..我測試的function return值也正確 這樣大概沒問題了!!^^
系統時間:2024-11-24 10:00:06
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!