EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Enter PIN programmatically

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
Posted: 02/26/2013 13:01:46
by Ken Ivanov (EldoS Corp.)


Yes that was the mistake. Now It compiles, but
still the DLL asks for the PIN.

Unfortunately, this means that the cryptocard doesn't accept PINs in programmatic way so you will have to use a workaround - e.g. your PIN dialog trick.

On the WIN XP there is the property: .OperationPIN and I can compile
But on the WIN 7 PC there is no property .OperationPIN.

Please re-check that there is no older SBB version left on a Windows 7 machine. The property should show up independently of the OS version, so it is likely that older units are accidentally referenced.
Posted: 02/26/2013 14:38:52
by walter Schrabmair (Basic support level)
Joined: 12/15/2012
Posts: 43

Thanks a lot,

I have uninstalled, deleted every *box*.bpl from system32 and from sysWoW64
and reinstalled without success.

Could you tell me, which files are envolved with the new property .OperationPIN?

ALl my SSB are from 4th Feb 2013 15:21. Is that correct, I really can not find an old version anymore. MOreover I have cleaned the registry with CCleaner after deinstalling.
Thanks for your help
Posted: 02/26/2013 23:56:19
by Ken Ivanov (EldoS Corp.)

The OperationPIN property is declared in TElPKCS11CryptoProviderOptions class, which is defined in SBCryptoProvPKCS11 unit, which, in turn, is included to PKIBlackbox package. Just to be sure, I've re-checked the 10.0.232 installation (the version of 4th February, which you've got installed), and the property is there.

For an extra check, you might wish to open the SBCryptoProvPKCS11.dcu file with some binary viewer and look for 'OperationPIN' substring inside.
Posted: 02/27/2013 02:01:32
by walter Schrabmair (Basic support level)
Joined: 12/15/2012
Posts: 43

I have found the OperationPIN in the SBCryptoProvPKCS11.dcu.
Moreover I have add the Directories

C:\Program Files (x86)\EldoS\SecureBlackbox.VCL\Packages
C:\Program Files (x86)\EldoS\SecureBlackbox.VCL\Units\Delphi7

in the Searchpath and Librarypath of Delphi 7 on the first Position.

MOreover I have searched the HDD for a second SBCryptoProvPKCS11.dcu, but
have only the proper installed one in
C:\Program Files (x86)\EldoS\SecureBlackbox.VCL\Units\Delphi7

I am thankful for any good advice what to do.

on WIN 7 32bit it works fine, but not WIN 7 64bit.
Posted: 02/27/2013 02:10:27
by Eugene Mayevski (EldoS Corp.)

Delphi seems to use an extra cache for compiled files (we came across this before) and this can lead to problems. The best option is to finally purchase a license, get the source code and link it to your application (getting rid of precompiled DCUs).

Sincerely yours
Eugene Mayevski
Posted: 02/27/2013 02:28:30
by walter Schrabmair (Basic support level)
Joined: 12/15/2012
Posts: 43

One more thing.
I can rename SBCryptoProvPKCS11 in the directory and
I can still compile even I have still SBCryptoProvPKCS11; in the uses clause.

BUT I have noooo second SBCryptoProvPKCS11 on my system.
Posted: 02/27/2013 02:30:39
by walter Schrabmair (Basic support level)
Joined: 12/15/2012
Posts: 43

Thanks Eugen, yes my boss as accepted that we will buy a lic after when we have a budget for this year. I will be about summer I think.

I think you are right, it will be the cache.
Posted: 02/27/2013 02:35:24
by Eugene Mayevski (EldoS Corp.)

Just a thought - don't you accidentally have "Build with packages" option enabled for your project? If yes, then the unit is linked from the corresponding package file, rather than from the DCU.

Sincerely yours
Eugene Mayevski
Posted: 02/27/2013 08:44:37
by walter Schrabmair (Basic support level)
Joined: 12/15/2012
Posts: 43

Eugen, where is this option in Delphi 7?

BTW I could sucessfully finished the automized PKCS11 Mass-Signer.

The catching the event for entering the PIN and poking the PIN into the keyboardbuffer works fine.
Posted: 02/27/2013 08:46:12
by walter Schrabmair (Basic support level)
Joined: 12/15/2012
Posts: 43

Here is a code part of it. WINEVENT is from: http://www.greatis.com/delphicb/toys/


procedure TfrmMain.WinEvent1ForegroundWindow(Sender: TObject;
  WindowHandle: Integer);
  C: array[0..32767] of Char;
  i: integer;
  with lsvForegroundWindow.Items.Add do
    with Subitems do
      // Here is the Wnd Handling routine

      If (C = 'PIN-Verifikation') then
        for i:= 0 to 100000 do
        PostKeyEx32(Ord('1'), [], False);
        PostKeyEx32(Ord('2'), [], False);
        PostKeyEx32(Ord('3'), [], False);
        PostKeyEx32(Ord('4'), [], False);
        PostKeyEx32(Ord('O'), [ssAlt], False);
        if donetab < 10 then
          //PostKeyEx32(9, [ssAlt], False);
          donetab:= donetab+1;
        //PostKeyEx32(13, [], False);
        PostMessage(WindowHandle, WM_KEYDOWN, VK_RETURN, 0);


procedure TfrmMain.PostKeyEx32(key: Word; const shift: TShiftState; specialkey: Boolean);
* Procedure PostKeyEx32
* Parameters:
*  key    : virtual keycode of the key to send. For printable
*           keys this is simply the ANSI code (Ord(character)).
*  shift  : state of the modifier keys. This is a set, so you
*           can set several of these keys (shift, control, alt,
*           mouse buttons) in tandem. The TShiftState type is
*           declared in the Classes Unit.
*  specialkey: normally this should be False. Set it to True to
*           specify a key on the numeric keypad, for example.
* Description:
*  Uses keybd_event to manufacture a series of key events matching
*  the passed parameters. The events go to the control with focus.
*  Note that for characters key is always the upper-case version of
*  the character. Sending without any modifier keys will result in
*  a lower-case character, sending it with [ssShift] will result
*  in an upper-case character!
  TShiftKeyInfo = record
    shift: Byte;
    vkey: Byte;
  byteset = set of 0..7;
  shiftkeys: array [1..3] of TShiftKeyInfo =
    ((shift: Ord(ssCtrl); vkey: VK_CONTROL),
    (shift: Ord(ssShift); vkey: VK_SHIFT),
    (shift: Ord(ssAlt); vkey: VK_MENU));
  flag: DWORD;
  bShift: ByteSet absolute shift;
  i: Integer;
  for i := 1 to 3 do
    if shiftkeys[i].shift in bShift then
      keybd_event(shiftkeys[i].vkey, MapVirtualKey(shiftkeys[i].vkey, 0), 0, 0);
  end; { For }
  if specialkey then
    flag := 0;
  keybd_event(key, MapvirtualKey(key, 0), flag, 0);
  flag := flag or KEYEVENTF_KEYUP;
  keybd_event(key, MapvirtualKey(key, 0), flag, 0);
  for i := 3 downto 1 do
    if shiftkeys[i].shift in bShift then
      keybd_event(shiftkeys[i].vkey, MapVirtualKey(shiftkeys[i].vkey, 0),
        KEYEVENTF_KEYUP, 0);
  end; { For }
end; { PostKeyEx32 }
Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.



Topic viewed 9407 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!