Click here to Skip to main content
15,885,546 members
Articles / Programming Languages / C++

64-bit electronic key

Rate me:
Please Sign up or sign in to vote.
4.20/5 (3 votes)
20 Apr 2009CPOL2 min read 39.5K   331   6   6
This article demonstrates the use of serial number DS1990 to obtain authorized access to the application.

Introduction

In the article, I am going to demonstrate how to use Serial Number DS1990 from Dallas Semiconductor as an electronic key to obtain authorized access to an application. This will be the continuation of my article about 1-Wire technology, where I have described temperature measurement [1]. My first concept was to modify the gina.dll library which is used while logging in to Windows. But, as I saw it could cause a lot of problems for beginners and even lock access to the system, I decided to give up it. Nevertheless, for advanced users, I recommend reading [2], [3].

Why DS1990?

Image 1

Fig. 1. DS1990 memory map [4]

DS1990 is a serial number [4] which contains a unique ROM number (Fig. 1). The number consists of an 8-bit CRC code, a 48-bit serial number, and an 8-bit family code. There are no identical ROM numbers in the world. The other advantages are: very long working life, it is cheap in comparison with transponders or other identity cards, the serial number could be checked because it contains a CRC code, it could be easily implemented in both PCs and microcontrollers.

Installation

To use this software, you will need:

  1. DS9097E adapter, which was described in [1] (Fig. 2)
  2. DS1990 serial key (Fig. 3)
  3. iButton Probe DS9092 or its equivalent [5] (Fig. 4)

Image 2

Fig. 2. DS9097E adapter [1]

Image 3

Fig. 3. DS1990 serial key

Image 4

Fig. 4. iButton probe

Using the code

C++
#include <conio.h>
#include <stdio.h>
#include "onewire.h"

void main(int argc, char **argv)
{
    short* ROM = new short[8];
    COneWire key("IBFS32.DLL",OW_ADAPTER_DS9097E,1);
    short data[] = {'a','b','c','1','2','3'};

    if(!key.StartSession())
    {
        printf("%s\n",ErrorDescr(key.GetLastError()));
        exit(-1);
    }

    printf("Ready to read...\n");

    while(!_kbhit())
    {
        if(key.FindDevices() == 1)
        {
            key.GetRomCode(0,ROM);
            for(int i=0;i<8;i++)
                printf("%2X ",ROM[i]);
            printf("\n");
        }
        Sleep(10);
    }

    delete[] ROM;

    key.EndSession();
}

In a loop, I am checking whether the electronic key was touching the probe. If it was, I read the ROM and print it.

Conclusions

There are unlimited applications for DS1990 serial numbers. I hope you will have your own. And to conclude, you have to be conscious that some people have created emulators of DS1990 serial numbers, but do not worry: as long as the robber does not know your key number, you are safe. Also, if you lose your traditional key, everybody could make a copy of it.

Bibliography

  1. Temperature Measurement as an Example of a 1-Wire Technology Application
  2. Winlogon using Mobile Disk
  3. Customizing GINA, Part 1
  4. DS1990 documentation
  5. Demiurg - the producer of Probe DS9092's equivalent

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer Technical University of Lodz
Poland Poland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionMaximum number of keys stored Pin
Member 435747111-Feb-15 5:00
Member 435747111-Feb-15 5:00 
GeneralBest Contributor On CP For OneWire Pin
Cleveland Mark Blakemore17-Jun-10 18:54
Cleveland Mark Blakemore17-Jun-10 18:54 
GeneralNot particularly secure Pin
supercat921-Apr-09 7:16
supercat921-Apr-09 7:16 
GeneralRe: Not particularly secure Pin
Jakub Piwowarczyk21-Apr-09 9:50
Jakub Piwowarczyk21-Apr-09 9:50 
GeneralRe: Not particularly secure Pin
supercat923-Apr-09 5:24
supercat923-Apr-09 5:24 
GeneralRe: Not particularly secure Pin
Jakub Piwowarczyk8-Dec-11 8:27
Jakub Piwowarczyk8-Dec-11 8:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.