admin管理员组文章数量:1287956
I'm planning to make a login system by USB, so if you put in a USB-drive and open a specific webpage, the website asks the USB-drive for the code (e.g. by a JavaScript file, a redirect or something like that).
The problem is, because of sandboxing, you can't load or redirect to local files. I don't know a solution for this problem. Can you guys help me? I don't need specific code, just an example or something in that way.
I'm planning to make a login system by USB, so if you put in a USB-drive and open a specific webpage, the website asks the USB-drive for the code (e.g. by a JavaScript file, a redirect or something like that).
The problem is, because of sandboxing, you can't load or redirect to local files. I don't know a solution for this problem. Can you guys help me? I don't need specific code, just an example or something in that way.
Share Improve this question edited Mar 9, 2021 at 3:39 Amir 1,3483 gold badges15 silver badges29 bronze badges asked Nov 4, 2013 at 22:16 maxdaniel98maxdaniel98 6,9746 gold badges21 silver badges23 bronze badges 6- 4 You're trying to re-invent client SSL certificates. Don't re-invent the wheel; use them. – SLaks Commented Nov 4, 2013 at 22:18
- 4 Make a browser plugin, that interact with your website? As of the previous ment, while it's true that you should use what already exists, I would consider sad to stop innovation because of a single sentence. – Alexandre TryHard Leblanc Commented Nov 4, 2013 at 22:21
- Thats the problem, I don't want to put a SSL certificate on a shared puter, for example on my school. Also I rather don't want to create plugins, also because of the shared puter thing. – maxdaniel98 Commented Nov 4, 2013 at 22:35
- Why do you think it is a good idea to let websites read data from your disks? There is a reason why this does not work. – stark Commented Nov 4, 2013 at 22:50
- @stark, I know, but I'd like to use that USB-drive to authenticate on a website, the only way to login then, is to use that USB-drive, some thing only I have. – maxdaniel98 Commented Nov 4, 2013 at 22:53
5 Answers
Reset to default 3Maybe you can read up on USB-HID
. Wikipedia:
The USB human interface device class (USB HID class) is a part of the USB specification for puter peripherals: it specifies a device class (a type of puter hardware) for human interface devices such as keyboards, mice, game controllers and alphanumeric display devices.
Here are some references:
- USB HID (Human Interface Device)
node-hid
- AccessUSB HID
devices from node.jsDepthJS
: 'Allows any web page to interact with the Microsoft Kinect using Javascript'.- A related Stackoverflow question: Write data to USB HID using Javascript, HTML5, or any cross platform language (supports Android)
One other possibility is to check out the Chrome HID (Human Interface Device) APIs:
- Interacting with USB HID devices from web apps – via Chrome Apps, see below
- Relevant Chrome API docs
Please note that for the time being, you cannot interact directly with the USB device (i.e. you cannot access any WebAPI offering that kind of fine-grained control).
Building a Chrome App (different from a Chrome Extension) may help; This article may point you in the right direction, since it also provides sample code.
The only way I can think of is putting a html file on the usb stick that essentially generates some sort of login token and gives you a link or a form to a login processor. You can then access the webpage by opening the local file first which will redirect you to the actual webpage.
This local script may include a javascript from the server to get some challenge-response-data which it hashes somehow (perhaps in bination with a password) and puts it into the form data.
Web PKI authentication from Modern Browsers may be achieved by using Browser Extension. One such extension is Signer.Digital browser extension. Use below Javascript promises from the APIs provided by Signer.Digital extension.
SignerDigital.getSelectedCertificate()
to register user's certificate
SignerDigital.signHash(hash)
to sign token at browser and verify at server
For all Javascript APIs refer to SO Answer https://stackoverflow./a/63173083/9659885
Disclaimer : I work for a pany supporting the application below
Hello, you may try to use Nexu open-source application for munication with smartcards or USB tokens. It also support PKCS 12 keystores. For example, the application is connected to the DSS webpage on the website of European Commission : see the link.
本文标签: javascriptHow can I access to USB stick from websiteStack Overflow
版权声明:本文标题:javascript - How can I access to USB stick from website? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741278306a2369861.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论