473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Serial Communication with Smartcard

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

Sep 17 '06 #1
0 2192

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andreas Horneff | last post by:
Hi @ all, I've got a problem with serial communication in Borland C++ Builder. I've already found a lot of stuff about serial communication in the internet, but it dosen't work. What I want...
1
by: Martin | last post by:
I have a couple of questions around code signing with MS technology: 1. Is there a way to transfer the generated strong name signing private key directly to a smartcard (or generate it on the...
3
by: carmen | last post by:
I'm working in an aplication for a Smart Device that need to "talk" with a printer continuosly through the serial port. I'm trying to use the John Hint's sample code "Use P/Invoke to develop a .NET...
4
by: Vidya Bhagwath | last post by:
Hello Experts, I am porting the C++ code into the Visual C#.NET. My C++ code is mainly based on the serial communication. So I am using the windows structure such as DCB.. etc and the windows...
6
by: Leandro Berti via DotNetMonster.com | last post by:
Hi All, I wrote a code to do serial communication with an equipament. When i use the code outside of threaded class it seens work properly, but when i put inside a class and execute a thread in...
4
by: joe bloggs | last post by:
I am writing a mobile application to interface with a legacy system and I am planning to use web services to communicate with this system. The legacy system receives data through a serial port. ...
4
by: max_mont | last post by:
Hi all, I'm a newbie in .NET technology. I've already developed Serial communication applications in C++ (WIN32). And I wanted to migrate to .NET technology. There is a serial component in...
2
by: Adrian Chen | last post by:
please help me! I come across a problem. Now I develop a finger print management system which is based on B/S.When users click a button in the web pages, a device connected to the COM1 serial port...
0
by: Dhananjay | last post by:
Hi, I am working on an VB.Net application which I want to communicate to external device using comm port (Serial Port) . So for that first I am trying to simulate the communication on serial...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.