How to getting started with magnetic stripe cards?

Ebrahim Ghasemi picture Ebrahim Ghasemi · Apr 13, 2015 · Viewed 21.8k times · Source

I am newbie in the field of Magnetic-Stripe cards. But if I don't have any idea about the structure of these kind of cards, I can't develop software for them also.

Searching a lot, gave me this information only :

This cards have 3 different Tracks named Track-1, Track-2 and Track-3 in their black bar. And the density of data on each Track is different from the others.

The questions that I have :

  1. Is there any difference between Mag-Stripe card reader and writer? Or like smart cards reader, the reader do the writing also?

  2. Does all the readers[/writers] can read from[/write on] all the three tracks by default and we choose that which track is our target on the program? or some readers [/writers] are for Track-1, some other for Track-2 and some other for Track-3? In the other word, does the device need three different head(Is it a head?) for working with different Tracks or a single head are for all the three Tracks?

  3. Are these three Tracks both readable and writable or some are only readable for example?

  4. Does we need fresh cards to writing data on them or we can clear an already used card and rewrite new data on its Tracks?

  5. There is a device named Encoder in the list of devices for Mag-Stripe card. What is this Encoder for? What's the difference between Encoder and Reader or Writer?

  6. Why the density of data and the type of data (Alphabetic or Numeric) is different for different Tracks?

  7. Any tool, document, specification, standard, library or tutorial for getting started?

Answer

anon picture anon · Apr 13, 2015

First, you'll want to read up on ISO-7811 and ISO-7812 mag card standards.

Then, you'll need to learn how to wire up a minimal working example (MWE) system. Fortunately, card readers are easy to come by, and you can just wire them up directly to something like an Arduino.

For at least one example, the format for bank cards is:

% "ASCII string on track 1" ?; "ACSII string on track 2" ?; "ASCII string on track 3" ?

It's just a serial stream that is provided, so "packets" will be different for different types of cards. Since this is just a reader, treat all data as read-only.

You can also find some existing code examples for pulling the data off of the card.

You can also find "blank" cards on SparkFun as well, but you'll need to put in some more money for a writer setup. Also, all sort of mag swipe cards have security features these days, including universities, credit cards, etc, so that portions of the mag stripes are hard to read or are read-only, etc.

If you're planning on doing something shady, these tools won't work, and rightfully so.

If you're planning on making your own security system for a lab or school, these cards are easily cloned and cracked by a clever person.

If you're just trying to have some fun learning a new topic, the above advice will be helpful.

Cheers!