Re: trying to work with WinSCard

From: Dan Griffin (dangriff_at_online.microsoft.com)
Date: 10/23/03


Date: Wed, 22 Oct 2003 17:14:24 -0700

Personally, I would first try to get the code working in C/C++, then move to
C#. Then, pick one of the simplest commands your card supports and try
sending that - i.e. a short command that only expects a status word in
response.

-- 
Dan Griffin [MS]
Please do not send email directly to this alias.  This alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.
"Ray" <Ray@noSpamPlease.com> wrote in message
news:RGYkb.57778$th6.20097@twister.socal.rr.com...
> I am having a problem with issuing commands to my smartcard, I converted
the
> call to SCardTransmit as follows:
>
> [C#]
>
> [DllImport("WinSCard.dll", EntryPoint="SCardTransmit",
> CharSet=CharSet.Unicode, CallingConvention=CallingConvention.StdCall)]
> public static extern uint SCardTransmit(
> [In] uint hCard,
> [In] byte[] pioSendPci,
> [In] byte[] pbSendBuffer,
> [In] int cbSendLength,
> ref byte[] pioRecvPci,
> [Out] byte[] pbRecvBuffer,
> ref int pcbRecvLength);
>
> and created byte arrays of the lengths needed to mimic each of the structs
> that are supposed to be passed in/out, but when I call SCardTransmit, i
get
> an return value which means Invalid Parameter.  I've tried several
different
> approaches, none of which worked any better.   (first I actually had
structs
> created with all the layout sizes and offsets defined, but I decided to
just
> try this instead, but all give me the same response)  If anyone has a clue
> to what I am doing incorrectly here, please lemme know.
>
> (BTW, I have called SCardEstablishContext, and SCardConnect before this
call
> successfully)
>
> Thanks.
>
> Ray
>
>
>


Relevant Pages

  • Re: Smart Card Transmit Usage
    ... select File and some other commands through SCardTransmit ... > commands to be issued to smart card and some document which has a ... > SCardTransmit Function. ...
    (microsoft.public.platformsdk.security)
  • Re: Token Serial Number
    ... SCardTransmit is a public Win32 API. ... >>The commands are likely specific to the card you plan to ... >>Eric Perlin ... >>> I'm trying to get the smart card' serial number using ...
    (microsoft.public.platformsdk.security)
  • Re: Token Serial Number
    ... You need to send commands to the smartcard using SCardTransmit. ... The commands are likely specific to the card you plan to use. ...
    (microsoft.public.platformsdk.security)
  • trying to work with WinSCard
    ... public static extern uint SCardTransmit( ... ref int pcbRecvLength); ... and created byte arrays of the lengths needed to mimic each of the structs ...
    (microsoft.public.platformsdk.security)

Quantcast