Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 移除读取器时,PKCS11WaitForSlotEvent存在互操作问题_Vb.net_Pkcs11interop - Fatal编程技术网

Vb.net 移除读取器时,PKCS11WaitForSlotEvent存在互操作问题

Vb.net 移除读取器时,PKCS11WaitForSlotEvent存在互操作问题,vb.net,pkcs11interop,Vb.net,Pkcs11interop,我设置了pkcs11Interop库,如下所示 Pkcs11Library = PkcsFactories.Pkcs11LibraryFactory.LoadPkcs11Library(PkcsFactories, pkcs11LibraryPath, AppType.MultiThreaded) 然后,我立即使用包含WaitForSlotEvent的WPF Dispatchermer Private Sub CardInsertedTimer_Tick(sender As O

我设置了pkcs11Interop库,如下所示

Pkcs11Library = PkcsFactories.Pkcs11LibraryFactory.LoadPkcs11Library(PkcsFactories, pkcs11LibraryPath, AppType.MultiThreaded)
然后,我立即使用包含WaitForSlotEvent的WPF Dispatchermer

        Private Sub CardInsertedTimer_Tick(sender As Object, e As EventArgs)
            Dim eventHappened As Boolean
                Dim id As ULong

                Pkcs11Library.WaitForSlotEvent(WaitType.NonBlocking, eventHappened, id)

            If eventHappened Then
                Debug.Print("CardInsertedEvent - Event - Event: " + eventHappened.ToString + "  ID: " + id.ToString)
            End If
        End Sub
我希望这里没有意外。如果插槽(是一个USB智能卡读卡器)被移除,那么我会得到一个C_WaitForSlotEvent返回的CKR_DEVICE_错误

  • WaitForSlotEvent的调度员可以吗
  • 我应该如何避免C_WaitForSlotEvent CKR_DEVICE_错误
  • pkcs11Interop是否处理插槽的添加和删除(即。 智能卡阅读器)
  • 如果pkcs11Interop不处理添加和删除插槽,则将进行轮询 唯一的办法是什么?最好的投票方式是什么

>对于WaitForSlotEvent,调度员可以吗?

一般来说应该没问题。您也可以考虑使用“代码”> WaistFrsLoToviv./Cube >从单独的线程调用的阻塞模式。

>我应该怎么做才能避免C\u WaitForSlotEvent CKR\u设备错误?

您需要询问非托管PKCS#11库的供应商

AFAIK
C_WaitForSlotEvent
是为令牌/卡相关事件而设计的,而不是为插槽/读卡器相关事件而设计的。说明当您添加或删除插槽/读卡器时,可能需要重新加载PKCSා11库,甚至重新启动操作系统:

在某些平台上,或早期兼容PKCS11的库中,可能需要成功调用
C_Initialize
或重新启动整个系统

pkcs11Interop是否处理插槽(即智能卡读卡器)的添加和删除

Pkcs11Interop只提供对非托管函数
C_WaitForSlotEvent
的访问权限,如中所述

>如果pkcs11Interop无法处理添加和删除插槽的问题,那么轮询是唯一的方法,最好的轮询方式是什么?


请参阅第一个问题的答案。

谢谢。我正在处理(Atos)CaedOS v5.3-您对避免错误有什么想法吗?避免删除读取器或捕获特定异常,并在应用程序中适当地处理它。