Is it possible to access a smartcard reader connected to a computer from a web browser running on the same machine, i.e. from an ActionScript, JavaScript or whatsoever scrip
Q: is it possible to access smartcard reader connected to a computer from a web browser running on the same machine?
A: Yes, it is possible. I was able to do that by using a signed JAVA applet. The java applet needs to be signed since it will require user to grant permission to access system files/hardware(same as letting an applet write/edit/delete a text file for you).
Why java? the smart card reader I used already has a JAVA API, it also have examples on accessing it using java. But the examples are coded in swing. (like a standalone desktop application) What I did is simply porting the java swing code to applet on a browser. I successfully used this applet to make a login and log out on a website/webapp by requiring smart cards, username and password. Pretty secure I would say.
The source code? As much as I would like to share it, but I'm bound on a company contract to not share the code. Just find a sample smart card access using java and just port it to applet(for web)
I hope this helps
You can use a signed Java applet to access the reader. Signed applets are allowed to access hardware peripherials, the smartcard reader can be accessed via the Java Crypto API.
Hope this helps.
You can also have a look at this beta native plugin:
https://github.com/ubinity/webpcsc-firebreath
It is cross-browser/cross-pltaform plugin based on firebreath framework, exposing a subset of the PCSC API.
When this proposal "Smart cards in browsers" gets implemented, we will also be able to use JavaScript for this.
You can't achieve this with ActionScript/Flash if you've to stick to the browser.
Adobe AIR could do this, but then you'd have to build an application which the user has to install prior to using it.
Something like this (AIR): http://cookbooks.adobe.com/post_Mass_Storage_Device_Detection_AIR_2_0-16747.html
If you can access the smartcard on your file system, like when a USB drive is connected and appears as a separate disk, then you can simply use flash.net.FileReference.