EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Enter PIN programmatically

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#23758
Posted: 02/26/2013 13:01:46
by Ken Ivanov (EldoS Corp.)

Walter,

Quote
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.

Quote
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.
#23761
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
Walter
#23764
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.
#23765
Posted: 02/27/2013 02:01:32
by walter Schrabmair (Basic support level)
Joined: 12/15/2012
Posts: 43

Ken,
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.
Walter

on WIN 7 32bit it works fine, but not WIN 7 64bit.
#23766
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
#23767
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.
#23768
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.
Thanks
Walter
#23769
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
#23781
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.
#23782
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/

Code

procedure TfrmMain.WinEvent1ForegroundWindow(Sender: TObject;
  WindowHandle: Integer);
var
  C: array[0..32767] of Char;
  i: integer;
begin
  with lsvForegroundWindow.Items.Add do
  begin
    Caption:='$'+IntToHex(WindowHandle,8);
    with Subitems do
    begin
      GetClassName(WindowHandle,C,SizeOf©);
      Add©;
      GetWindowText(WindowHandle,C,SizeOf©);
      Add©;
      // Here is the Wnd Handling routine
      ListBox1.Items.Add©;

      If (C = 'PIN-Verifikation') then
        begin
        Listbox2.Items.Add©;
        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
          begin
          //sleep(2000);
          SetFocus;
          //PostKeyEx32(9, [ssAlt], False);
          donetab:= donetab+1;
          end;
        //PostKeyEx32(13, [], False);
        PostMessage(WindowHandle, WM_KEYDOWN, VK_RETURN, 0);
        //DestroyWindow(WindowHandle);
        //PostMessage(WindowHandle,WM_Close,0,0);
        end;


    end;
  end;
end;

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!
************************************************************}
type
  TShiftKeyInfo = record
    shift: Byte;
    vkey: Byte;
  end;
  byteset = set of 0..7;
const
  shiftkeys: array [1..3] of TShiftKeyInfo =
    ((shift: Ord(ssCtrl); vkey: VK_CONTROL),
    (shift: Ord(ssShift); vkey: VK_SHIFT),
    (shift: Ord(ssAlt); vkey: VK_MENU));
var
  flag: DWORD;
  bShift: ByteSet absolute shift;
  i: Integer;
begin
  for i := 1 to 3 do
  begin
    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 := KEYEVENTF_EXTENDEDKEY
  else
    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
  begin
    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: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.

Reply

Statistics

Topic viewed 8352 times

Number of guests: 2, 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!