コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tokenPresent"></param>
        /// <returns></returns>
        public uint[] GetSlotList(bool tokenPresent)
        {
            C_GetSlotList proc = (C_GetSlotList)DelegateUtil.GetDelegate(this.hLib, typeof(C_GetSlotList));

            uint pullVal = 0;

            checkCKR(proc(tokenPresent, null, ref pullVal));

            uint[] slots = new uint[pullVal];
            checkCKR(proc(tokenPresent, slots, ref pullVal));

            return(slots);
        }
コード例 #2
0
 public static void PKCS11_init(string lib)
 {
     initialize          = CreateDynamicDllInvoke <C_Initialize>("C_Initialize", lib);
     open_session        = CreateDynamicDllInvoke <C_OpenSession>("C_OpenSession", lib);
     close_session       = CreateDynamicDllInvoke <C_CloseSession>("C_CloseSession", lib);
     login               = CreateDynamicDllInvoke <C_Login>("C_Login", lib);
     logout              = CreateDynamicDllInvoke <C_Logout>("C_Logout", lib);
     create_object       = CreateDynamicDllInvoke <C_CreateObject>("C_CreateObject", lib);
     get_slot_list       = CreateDynamicDllInvoke <C_GetSlotList>("C_GetSlotList", lib);
     get_attribute_value = CreateDynamicDllInvoke <C_GetAttributeValue>("C_GetAttributeValue", lib);
     get_mechanism_list  = CreateDynamicDllInvoke <C_GetMechanismList>("C_GetMechanismList", lib);
     get_slot_info       = CreateDynamicDllInvoke <C_GetSlotInfo>("C_GetSlotInfo", lib);
     get_token_info      = CreateDynamicDllInvoke <C_GetTokenInfo>("C_GetTokenInfo", lib);
     get_session_info    = CreateDynamicDllInvoke <C_GetSessionInfo>("C_GetSessionInfo", lib);
     get_info            = CreateDynamicDllInvoke <C_GetInfo>("C_GetInfo", lib);
     open_session        = CreateDynamicDllInvoke <C_OpenSession>("C_OpenSession", lib);
     close_session       = CreateDynamicDllInvoke <C_CloseSession>("C_CloseSession", lib);
     find_objects_init   = CreateDynamicDllInvoke <C_FindObjectsInit>("C_FindObjectsInit", lib);
     find_objects        = CreateDynamicDllInvoke <C_FindObjects>("C_FindObjects", lib);
     find_objects_final  = CreateDynamicDllInvoke <C_FindObjectsFinal>("C_FindObjectsFinal", lib);
     sign           = CreateDynamicDllInvoke <C_Sign>("C_Sign", lib);
     destroy_object = CreateDynamicDllInvoke <C_DestroyObject>("C_DestroyObject", lib);
     finalize       = CreateDynamicDllInvoke <C_Finalize>("C_Finalize", lib);
 }