Inteface with Smart Card reader
Hi
i m working on small project . In my project i have to interface with smart card .I m doing my project in C# 2005 . But i dont know how to program with Smart Card reader.how to read and write to Smart Card. Help me
Hi
i m working on small project . In my project i have to interface with smart card .I m doing my project in C# 2005 . But i dont know how to program with Smart Card reader.how to read and write to Smart Card. Help me
I too am doing similar work utilizing smart card reading integration into a .Net C# application. My particular scenario involves a Gemplus USB reader. I've been using the Interop assembly to work via the winscard.dll and have successfully called SCardEstablichContext, SCardListReaderGroups, SCardListReaders, and SCardReleaseContext. However,
I'm stuck at SCardConnect. It appears that an error is thrown to which there is not corresponding translation. So, I have no idea what I'm dealing with.
Is there any documentation, ANYWHERE, that uses C# as the primary language instead of the native code? At least that way, I could verify that my dll imports are coded correctly for the native function to work properly.
As prevalent as smart cards are becoming, I'm surprised that there aren't better documentation resources readily available.
Thanks for any and all responses.
BW
[
DllImport("winscard.dll", EntryPoint = "SCardConnectA", CharSet = CharSet.Auto)]string
szReader = globalreader; //Gemplus USB Smart Card Reader 0//SCARD_SHARE_EXCLUSIVE = 0;
UInt32 Mphcard = 0;{
lblResults.Text +=
{
//string rethex = String.Format("{0:x2}", ret4);lblResults.Text +=
"\n" + ret4 + " - SCardConnect call is not a success \n";Error(ret4,
"SCardConnect() is throwing an error");}
The error I receive is -2146435063; which I believe equates to 0x80100009 (Unknown Reader). Not sure why I keep getting this error since the reader is returned from the SCardListReaders call. The out variable never get filled. I get the return value of 0 for the SCardEstablishContext, SCardListGroups, and SCardListReaders, and SCardReleaseContext.
Thanks,
R/BW
I have the same issues. after i change it to SCardConnectW. it's still giving me the error code
thanks.
I am using EMVCO USB SmartCard reader and I want to know how to start connecting and reading data?
any resources or samples please?
Hi!
I'm working on a small project that will read and write in a Smart Card but i don't know how to do it. i'm doing my project in Visual Basic. Need some help.
Thanks..
http://pinvoke.net/default.aspx/winscard.ASCIIEncoding
http://www.codeproject.com/smartclient/SmartcardFmwk.asp
Try Changing the Charset.Auto to Unicode or ascii (just try it solved an issue for me once)
Try these parameters in scardconnect:
dwShareMode = SCARD_SHARE_SHARED
dwPreferredProtocols = SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1