Reputation: 314
I'd like to be able to detect when a USB key is inserted. Furthermore, if I can distinguish between USB key A and USB key B then I am in even better shape. Lastly, if I can uniquely identify the key using some sort of hardware serial number, MAC address or whatever, then I'm in the best shape of all.
Basically I am looking at using a USB key as a hardware dongle to "unlock" my C# application.
Upvotes: 5
Views: 6193
Reputation: 158
Hard Disk Id is not unique. Maybe theoretically it is, but in practice it is not. This is without any crack, emulator or any special program.
Upvotes: 0
Reputation: 19171
All hard-drives have a Serial Number, USB flash drives are no different. Here is an article, with a sample project, that shows how to get the non-volatile serial number. Basically you just need to enumerate the system drives and grab the PNPDeviceID property.
Upvotes: 8
Reputation: 8035
You need to retrieve the key's Hardware ID.
I don't see how to subscribe to the plugged-in event, but you could always have the user click a button too.
Upvotes: 0