This project uses a GPIO (general purpose Input/Ouptut) pin on a BeagleBone Black to programmatically activate a physical security token that normally requires the user to physically touch the device to generate a one time password. Sketches are provided for using an optocoupler and a transistor. You could also use a SPST relay, but no sketch is provided for that.

TRANSISTOR VERSION

The transistor version is probably the cheapest. A NPN transistor usually costs around 20 cents.

Parts list:

Required:

  1. Adafruit 1278 or Digi-Key BB-BBLK-000-ND BeagleBone Black

  2. Digi-Key 2N3904FS-ND NPN transistor

  3. Digi-Key 1.0KQBK-ND 1K resistor

Optional:

  1. Adafruit 64 Half-size breadboard

  2. Adafruit 153 Breadboarding wire bundle

  3. Adafruit 702 Proto plate for BeagleBone Black

  4. Radio Shack 270-0374 Mini 1-3/8" alligator clips

Instructions:

  1. Connect P8_12 (GPIO44) to the base pin of the NPN transistor (I tested with a 2N3904).

  2. Connect P8_2 (GROUND) to a 1K resistor.

  3. Connect the other end of the 1K resistor to the emitter pin of the NPN transistor.

  4. Connect the physical security key to the collector pin of the NPN transistor.

  5. Connect BeagleBone Black to computer. Visit the BeagleBone Black getting started website and install the network and serial drivers (as well as any others that are recommended).

  6. Ssh to the BeagleBone with putty (Windows) or the ssh command in a terminal (Mac, Linux). Connect to the host 192.168.7.2 with the username "root" and no password (press enter if asked for a password)

  7. Copy the C source file securitykey-test.c to the beaglebone with pscp (Windows) or scp (Mac, Linux).

    Example:
    C:\> pscp securitykey-test.c [email protected]:/home/root
    # scp securitykey-test.c [email protected]:/home/root
    
  8. Compile the C source file. Go to your putty or ssh session where you are logged into the BeagleBone.

    Run:
    root@beaglebone# cd /home/root
    root@beaglebone# gcc securitykey-test.c -o securitykey-test
    
  9. Generate one-time passwords with: ./securitykey-test

    Example:
    
    root@beaglebone:~# ./securitykey-test
    To generate a one-time password, press 1 for slot 1, 2 for slot 2 (Ctrl-C or q to quit): 1
    Generating OTP from slot 1
    vvwxxxwzqalvhrnwjjkieenpqsmlytwfhlqamwcydfej
    

OPTOCOUPLER VERSION:

The optocoupler version is the next cheapest. A transistor may cost 20 cents, while an optocoupler runs around 50 cents. Unfortunately, they are kind of hard to find (I could not find one at my local Radio Shack).

Parts list:

Required:

  1. Adafruit 1278 or Digi-Key BB-BBLK-000-ND BeagleBone Black

  2. Digi-Key 425-2765-ND Optocoupler 5V (Sharp PC817)

  3. Digi-Key 1.0KQBK-ND 1K resistor

Optional:

  1. Adafruit 64 Half-size breadboard

  2. Adafruit 153 Breadboarding wire bundle

  3. Adafruit 702 Proto plate for BeagleBone Black

  4. Radio Shack 270-0374 Mini 1-3/8" alligator clips

Instructions:

  1. Connect P8_12 (GPIO44) to pin 1 on the optocoupler

  2. Connect P8_2 (GROUND) to a 1K resistor.

  3. Connect the other end of the 1K resistor to pin 2 on the optocoupler.

  4. Connect the physical security key to pin 3 on the optocoupler.

  5. Connect P8_2 (GROUND) to pin 4 on the optocoupler.

  6. Connect BeagleBone Black to computer. Visit the BeagleBone Black getting started website and install the network and serial drivers (as well as any others that are recommended).

  7. Ssh to the BeagleBone with putty (Windows) or the ssh command in a terminal (Mac, Linux). Connect to the host 192.168.7.2 with the username "root" and no password (press enter if asked for a password)

  8. Copy the C source file securitykey-test.c to the beaglebone with pscp (Windows) or scp (Mac, Linux).

    Example:
    C:\> pscp securitykey-test.c [email protected]:/home/root
    # scp securitykey-test.c [email protected]:/home/root
    
  9. Compile the C source file. Go to your putty or ssh session where you are logged into the BeagleBone.

    Run:
    cd /home/root
    gcc securitykey-test.c -o securitykey-test
    
  10. Generate one-time passwords with:

    ./securitykey-test
    
    Example:
    
    root@beaglebone:~# ./securitykey-test
    To generate a one-time password, press 1 for slot 1, 2 for slot 2 (Ctrl-C or q to quit): 1
    Generating OTP from slot 1
    vvwxxxwzqalvhrnwjjkieenpqsmlytwfhlqamwcydfej
    

RELAY VERSION

(no sketch provided)

The relay version is the most expensive. 5 volt relays run anywhere from $1.30 (Digi-Key) to $6 (your local Radio Shack). Some are mechanical (the reed type) and may fail over time.

Parts list:

Required:

  1. Adafruit 1278 or Digi-Key BB-BBLK-000-ND BeagleBone Black

  2. Digi-Key Z2774-ND Relay SPST 5V (your local Radio Shack should also have a 5 volt SPST relay; I was able to find Tyco Electronics OMR-C-105H at my local Radio Shack)

  3. Digi-Key 1.0KQBK-ND 1K resistor

Optional:

  1. Adafruit 64 Half-size breadboard

  2. Adafruit 153 Breadboarding wire bundle

  3. Adafruit 702 Proto plate for BeagleBone Black

  4. Radio Shack 270-0374 Mini 1-3/8" alligator clips

Instructions:

  1. Connect P8_12 (GPIO44) to the coil input power.

  2. Connect P8_2 (GROUND) to a 1K resistor.

  3. Connect the other end of the 1K resistor to the coil input ground. NOTE: some relays have internal resistors. If you find that this circuit does not work, then check to see if that is the case. Two resistors may prevent the relay from activating. In that case, do not use the 1K resistor (from step 2 and 3). If using the Tyco OMR-C-105H from Radio Shack, then I confirmed you will need to omit the 1K resistor.

  4. Connect the physical security key to one of the normally open contacts (NO) on the relay.

  5. Connect P8_2 (GROUND) to the other normally open (NO) contact on the relay.

  6. Connect BeagleBone Black to computer. Visit the BeagleBone Black getting started website and install the network and serial drivers (as well as any others that are recommended).

  7. Ssh to the BeagleBone with putty (Windows) or the ssh command in a terminal (Mac, Linux). Connect to the host 192.168.7.2 with the username "root" and no password (press enter if asked for a password)

  8. Copy the C source file securitykey-test.c to the beaglebone with pscp (Windows) or scp (Mac, Linux).

    Example:
    
    C:\> pscp securitykey-test.c [email protected]:/home/root
    
    # scp securitykey-test.c [email protected]:/home/root
    
  9. Compile the C source file. Go to your putty or ssh session where you are logged into the BeagleBone.

    Run:
    cd /home/root
    gcc securitykey-test.c -o securitykey-test
    
  10. Generate one-time passwords with:

    ./securitykey-test
    
    Example:
    
    root@beaglebone:~# ./securitykey-test
    To generate a one-time password, press 1 for slot 1, 2 for slot 2 (Ctrl-C or q to quit): 1
    Generating OTP from slot 1
    vvwxxxwzqalvhrnwjjkieenpqsmlytwfhlqamwcydfej