EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Using OnSlotEvent in SBB C++ Edition

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#31767
Posted: 12/27/2014 16:09:02
by Adolfo García (Basic support level)
Joined: 12/14/2014
Posts: 14

Hello,

I'm having trouble using the OnSlotEvent of the PKCS#11 CertStorage class.
My current setup:
- Windows 8.1
- SBB 12.0.263 (C++ Edition)

The problem is that the event handler gets called just before I close my application (after the CertStorage is closed I guess).
I couldn't find a sample on how to use it; below is how I'm currently doing it.

The handler code:
Code
void onSlotEventHandler(void* _ObjectData, TObjectHandle Sender, TElPKCS11SlotInfoHandle Slot)
{
    cout << "Handler called!" << endl;
}


The pkcs11 OnSlotEvent setup code:
Code
// ...
pkcs11CertStorage->set_OnSlotEvent(onSlotEventHandler, 0);
// Default values for mode and delay:
// mode = semNoMonitoring, delay = 1000       pkcs11CertStorage->set_SlotEventMonitoringMode(SecureBlackbox::semStandard);
pkcs11CertStorage->set_SlotEventMonitoringDelay(ONSLOTEVENT_DELAY);
pkcs11CertStorage->set_MonitorSlotEvents(true);
// ...
#31770
Posted: 12/28/2014 00:23:54
by Eugene Mayevski (EldoS Corp.)

Can you please explain what the actual problem is - is the event fired too late or it should not be fired at all?


Sincerely yours
Eugene Mayevski
#31772
Posted: 12/28/2014 01:39:31
by Adolfo García (Basic support level)
Joined: 12/14/2014
Posts: 14

The problem is that the event is fired only after I call the close method of the cert storage instance, otherwise it doesn't fire.
Should I be polling the object somehow?
#31773
Posted: 12/28/2014 02:23:37
by Eugene Mayevski (EldoS Corp.)

And did you actually insert or remove the token (at any time, not just at application shutdown)?


Sincerely yours
Eugene Mayevski
#31774
Posted: 12/28/2014 02:26:06
by Adolfo García (Basic support level)
Joined: 12/14/2014
Posts: 14

Yes, I inserted the card and waited, but the event wasn't fired until I closed the cert storage.
#31775
Posted: 12/28/2014 02:47:33
by Eugene Mayevski (EldoS Corp.)

Try different values of SlotEventMonitoringMode property. Default value is NoMonitoring, which is not what you need, of course.


Sincerely yours
Eugene Mayevski
#31776
Posted: 12/28/2014 02:51:55
by Adolfo García (Basic support level)
Joined: 12/14/2014
Posts: 14

Just tried with semSynchronous (was using semStandard) but also didn't work.
#31777
Posted: 12/28/2014 02:56:22
by Eugene Mayevski (EldoS Corp.)

Did it "didn't work" by reporting the event at the end of it "didn't work" by reporting nothing at all?


Sincerely yours
Eugene Mayevski
#31778
Posted: 12/28/2014 02:58:59
by Adolfo García (Basic support level)
Joined: 12/14/2014
Posts: 14

The same issue as before: reporting the event at the end of it.
#31779
Posted: 12/28/2014 03:03:37
by Eugene Mayevski (EldoS Corp.)

I think I know where the problem can come from. What kind of application do you have - is it some console application or Windows GUI application or ... ?


Sincerely yours
Eugene Mayevski
Also by EldoS: Callback File System
Create virtual file systems and disks, expose and manage remote data as if they were files on the local disk.

Reply

Statistics

Topic viewed 1321 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!