简体   繁体   中英

How to get data from smartcard using Chrome extension

I want to develop a simple Chrome-extension that will handle the communication with my smartcard. After installing a driver (as described at Smartcard Reader and ChromeApp ) I can get some information of my device, like this:

device #0: {
    "device":0,
    "manufacturerName":"OMNIKEY AG",
    "productId":12322,
    "productName":"Smart Card Reader USB",
    "serialNumber":"",
    "vendorId":1899,
    "version":516
}

How can I continue? I need now to get ATR, and send/get data, and I have no idea how to do it... (we did it using some program languages, like Java, Python, C++, but I don't know where is the relevant API for JS/chrome)

Thank you.

Looks like you're trying to use the bare chrome.usb API for writing your extension. Basically, you would have to write a driver for smart card readers according to CCID specification ( here is the link to its revision 1.1). This is entirely possible, but is definitely not the easiest task.

The alternative solution would be to utilize the Smart Card Connector App that was recently released by Google. This app already bundles a generic CCID driver and implements more high-level PC/SC API. With this API, such operations as obtaining ATR or sending/receiving data to the card could be performed by relatively simple requests.

PS I would like to emphasize the fact that operating with USB devices from Chrome Apps works well and stable only under Chrome OS. With other OSes, there're a lot of possible pitfalls (generally speaking, when something in the system may prevent Chrome from accessing the USB device).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM