Hi everyone.
I've already read a lot about accessing SmartCard via C#, but they all
don't really fit, what I'm trying to do.
I'm experimenting with SLE 4442 Smartcards and I want to directly
(without any CTAPI or PC/SC) access the card. It should be possible,
shouldn't it?
What I'm doing:
I'm opening the serial port with the serialPort Element of .NET2.0.
I've written a small messagebox on the "PinChanged" Event to see if
anything happens, when a card is inserted.
I've also written the following code to the DataRecieved Event:
string tempstring = "";
byte[] buffer = new byte[this.serialPort1.BytesToRead];
this.serialPort1.Read(buffer, 0, this.serialPort1.BytesToRead);
for (int i = 0; i<buffer.Length;i++)
{ tempstring += (" 0x"+buffer[i].ToString("x2")); }
MessageBox.Show("Data Recieved!" + Environment.NewLine + "Data: " +
tempstring);
So far, so good.
When I'm inserting the card, i get a CsrChanged and DsrChanged Event,
and recieve a 0x00.
But now I want (for example) read the first Byte of the Main Memory.
Datasheet says I have to send 0x30 0x01 to the Smartcard.
byte[] Send = new byte[2];
Send[0] = 0x30;
Send[1] = 0x01;
serialPort1.Write(Send, 0, 2);
I thought I would get a response then, but I don't.
Might it be, because I have to do synchron data transfer?
How can I accomplish it with C#?
I know that the CT_DATA function of the CT-API sends and recieves in
one call, but as I mentioned I can't use the CT-API / PC/SC interface
(reader is too old, and no API available for my SC-Master LC).
Any help is welcome :)
Thanks in advance :)
Greets
Philipp