I have contact SLE4442 smart card (2W) and Omnikey 5421 smart card reader.
My problem is with connection to card. WinSCard's method SCardConnect
returns error SCARD_W_UNRESPONSIVE_CARD 0x80100066
. What is interesting this problem not exist with Omnikey 5321 (predecessor 5421). I post code that I used to test read of data (Delphi):
function GetResponseFromCard(const FCardHandle: Integer; const APdu:
string): string;
var
RetVar : cardinal;
SBuf : string;
SLen : cardinal;
RBuf : string;
RLen : cardinal;
Ppci : Pointer;
begin
SBuf := APdu;
RBuf := StringOfChar(#0,260);
Ppci := @SCARD_PCI_T0;
SLen := Length(APdu);
RLen := Length(RBuf);
RetVar := SCardTransmit(FCardHandle, Ppci, Pointer(SBuf), SLen, nil, Pointer(RBuf), @RLen);
if RetVar = SCARD_S_SUCCESS then begin
Result := Copy(RBuf,1,RLen);
end else begin
Result := IntToHex(RetVar, 8);
end;
end;
procedure TestSLE4442;
var
FContext: Cardinal;
PContext: Pointer;
Res: LongInt;
ReaderListStr: string;
ReaderListSize: integer;
v: array[0..10] of string;
SelectedReader: PChar;
phCard: Integer;
pdwActiveProtocol: Integer;
ReadedData: string;
begin
FContext := 0;
PContext := @FContext;
Res := SCardEstablishContext(SCARD_SCOPE_USER, nil, nil, PContext);
if Res = SCARD_S_SUCCESS then begin
Res := SCardListReaders(FContext, nil, nil, ReaderListSize);
if Res = SCARD_S_SUCCESS then begin
SetLength(ReaderListStr, ReaderListSize);
Res := SCardListReaders(FContext, nil, Pointer(ReaderListStr), ReaderListSize);
SortOutSubstrings(ReaderListStr,v,[#0]);
SelectedReader := PChar(v[0]);
ShowMessage('SelectedReader: '+ SelectedReader);
if Res = SCARD_S_SUCCESS then begin
Res := SCardConnect(FContext, SelectedReader, SCARD_SHARE_EXCLUSIVE, SCARD_PROTOCOL_T0, phCard, @pdwActiveProtocol);
if Res = SCARD_S_SUCCESS then begin
ReadedData := GetResponseFromCard(phCard, TStringHelper.Hex2Bin('FFB0000000'));
ShowMessage('Data: '+ ReadedData);
end;
end;
end;
SCardReleaseContext(FContext);
end;
end;
Have someone met with this problem? I also asked HID but without answer for now.
Thanks for help. I heard and I tired Synchronous Omnikey API. Vendor answered me that 2WBP is not supported in new 5421. Maybe there is chance using SCARD_SHARE_DIRECT because using this I'm able to connect to SLE4442 using 5421. But this is hard to tell what I can do more without vendor support.
User contributions licensed under CC BY-SA 3.0