17

I'm working on a JavaScript project that involves reading credit cards and driver's licenses from a USB magnetic stripe reader in keyboard emulation mode. It turns out getting credit cards working was extremely easy, as they're all in the same format. However it quickly became clear that driver's licenses are much harder, as even within a single state (CA) the format varies from one card to the next.

In any case, the goal is to take the raw data from swiping a driver's license (using a magnetic stripe reader) and extract the number from it, in a way that produces the correct number for as many U.S. states as possible (all 50 would be amazing). Worth mentioning is that I am not particularly concerned with validation, at least not at this point.

Has anyone else already done this, and packaged it all up in a library (either free or commercial) I could use? That would be awesome.

I should also note that while I'd love to see a JavaScript solution, in reality I'm open to investigating any solution, written in any language.

Dan Tao
  • 125,917
  • 54
  • 300
  • 447
  • Not _exactly_ what you were looking for, but hope this helps: http://www.tek-tips.com/viewthread.cfm?qid=701938 – Ayman Safadi May 01 '12 at 16:02
  • I really do wonder what your planning on doing with all that information! :P – Waltzy Jun 23 '12 at 00:44
  • @Waltzy: With names and driver's license numbers? Nothing much, really. It's just for identity verification for a system I'm working on. – Dan Tao Jun 23 '12 at 06:41
  • @DanTao: How does your raw data look like? Please give a few examples of valid input. – Madara's Ghost Jun 24 '12 at 18:33
  • 1
    @Truth: That's just the thing: I could give you the raw data for *my* license (California), but I don't have data for all 50 states. Are you asking because you intend to solve the problem yourself? If I had data for all 50 states I would do it myself. – Dan Tao Jun 24 '12 at 19:13
  • 1
    @DanTao: You should try to find common grounds between the different licence data types. If there is none, you'll have to code each one manually. – Madara's Ghost Jun 24 '12 at 19:15
  • Just a heads up, South Carolina licenses no longer have magstripes. We have a few different types of licenses now (older ones do), but the most current ones have a strangely formatted barcode, but no magstripe. – Breland Jun 27 '12 at 13:17
  • I'm encountering this issue in a project at work. I realize it's been a good while since you asked this question - what solution did you end up going with? – Nathan May 08 '14 at 14:29
  • @nathan or Dan Tao - Just wondering if you had found a solution to this? A scan and process via web application? – wirble Aug 13 '15 at 16:49
  • @wirble The way that project went (this was a few jobs ago), I ended up coding what I could at the time by collecting DLs from people in the office (we had plenty of CA licenses, and I think an Ohio one and another one or two) and then we deployed that and just started collecting data from manual entry as the software was used in the "field" (so to speak). Over time I reverse engineered a bunch more states from the magnetic data + manually entered data we got. It never got to 100% but it got better and better over time. – Dan Tao Aug 13 '15 at 17:47
  • @wirble We basically started the same approach as Dan but less effective :). My team got one Florida and one California license to test with for a short time at great difficulty (we're in NY), and the other formats are theoretically correct from online sources and a spreadsheet provided by our client. It's been tabled for a while (this is for a large project that stagnated until recently). IIRC there's at least two states that have the same number format, so at least some manual entry is required to be sure you're correct. – Nathan Aug 13 '15 at 20:51
  • @nathan and Dan I guess I am earlier in the process than you guys are. Can you please elaborate on the process, steps or dll/ocx you use to just hook onto the devices to get the raw data? Was it a custom or vendor dll/ocx for the device to hook from the web page. A lot of the samples are windows base, trying to determine if this is possible out of the box or requires custom work to determine timeline. – wirble Aug 13 '15 at 20:55
  • @wirble That depends on what devices you're using. We used a Magtek with a COM interface - that doesn't help you unless you're using the same device. Go to the manufacturer's website and look for developer resources. – Nathan Aug 14 '15 at 11:10

3 Answers3

8

First of all most states don't use magnetic stripe on drivers' licences, or at least that was the case in 2009: http://www.digitaldoorkeep.com/blog/tag/drivers-license-magnetic-stripe/

Finding data format for the remaining states is a matter of spending some time with google (I found this in 3 minutes: http://www.dgahouston.com/msrdata2.htm ) or actually requesting the information: it's public information.

Also read this: http://www.dgahouston.com/dlsplit1.htm - scanning licences is illegal in some states.

c2h5oh
  • 4,492
  • 2
  • 23
  • 30
  • +1 for the 'most state don't use magnetic stripes'. Maryland, as of 2007, had a printed bar code on the back. Colorado has neither. – Roddy of the Frozen Peas Jun 27 '12 at 16:07
  • 4
    These links have succumbed to rot - here are links to the [AAMVA](http://www.aamva.org), who define mag stripe and barcode standards. -- [Which states use which formats](http://www.aamva.org/ID-Security-Technologies/) (Go to US License Technology tab - 19 states use a mag stripe as of 2011) -- [Card Design standards](http://www.aamva.org/DL-ID-Card-Design-Standard/) (go to Documentation tab) – Nathan May 08 '14 at 14:06
  • Note that you probably still have to contact some states individually - there are some gotchas. For example, the mag stripe encodes ID #s as numeric only - alpha characters are converted to two numeric characters (A=01, B=02, Z=26, etc). It looks like you have to discover the letter based on valid driver license formats, but Missouri at least has formats that conflict - nine digits, and one character followed by seven digits. Without knowing some constraints, it's impossible to tell which format you've just encountered on a mag stripe. – Nathan May 08 '14 at 14:25
4

Hm, I'm not sure if this will be of help, but I ran across Jumio which has an online ID verification. I don't know if it would work with your current implementation of your strip scanner, but give it a look it could be exactly what you want: https://pay.jumio.com/

It works by either scanning the license with a built in webcam or uploading an image of the license to their server to verify. http://jumio.com/products/netverify/online-id-verification/

Good luck!

Stephen
  • 215
  • 1
  • 11
0

There's their library, but it's not free.

https://www.dynamsoft.com/store/dynamsoft-barcode-reader/

If anyone finds anything free I would love for them to update me as well.

Zvi Redler
  • 1,708
  • 1
  • 18
  • 29