Poor Man's Password Vault

DSCN7411a.JPG

The idea of a simulated USB keyboard captured my immagination back when I first learned about the Yubikey.  The web based authentication service was never very compelling.  But the idea of instantly typing a ridiculously long password is downright cool.  It was so cool, I bought one that very day.  

Unfortunately, the Linux based Yubico tools didn't live up to my expectations.  I was able to get a static password entered, but the tools felt half done and I felt like I was going to brick my $30 toy the next time a bug cropped up.  Added to that, the device didn't quite fill a USB port and quickly stopped working correctly - the very light pressure from the touch sensor was often enough to disconnect the USB.  Finally, after only a few months on my key chain the device died all together.

Enter the Digispark.  I learned that this tiny gem (an Arduino compatible microprocessor) can emulate a USB keyboard.  And it costs $9.  That's nine bucks - lunch money!  The Arduino IDE is intuitive and has extensive sample code.  Here was the code for my "poor man's static password Yubikey."

#include "DigiKeyboard.h"

void setup() {
pinMode(0, OUTPUT); //Convenient Voltage Source
pinMode(1, OUTPUT); //Blinky LED
pinMode(2, INPUT); //Button Input
digitalWrite(0,HIGH); //Turn on the source
}

void loop() {
DigiKeyboard.sendKeyStroke(0);
digitalWrite(1, LOW); //Blink a few times
DigiKeyboard.delay(250);
digitalWrite(1, HIGH);
DigiKeyboard.delay(250);
digitalWrite(1, LOW);
DigiKeyboard.delay(250);
digitalWrite(1, HIGH);
DigiKeyboard.delay(250);
if(digitalRead(2)==HIGH){//check multiple times to debounce
if(digitalRead(2)==HIGH){
if(digitalRead(2)==HIGH) DigiKeyboard.println("Some Really random password!");
}
digitalWrite(0,LOW); //Make sure we don't trigger twice
DigiKeyboard.delay(2000);
digitalWrite(0,HIGH);

}
}
DSCN7418a.JPG

The program is dirt simple.  It spits out a string when the input goes high.  It looks a bit more complicated because I'm blinking an LED just for fun and adding a few lines to clear the input to prevent multiple triggers.  

I initially had a physical button soldered between 0 and 2 (pin 1 is connected to an LED and the switch I had was just wide enough to span between 0 and 2).  I discovered I was triggering the text before I pushed the button.  My skin was conductive enough to complete circuit via the solder bumps.  So I removed the physical button and added some generous solder bumps.  It works just fine with no physical button.  

 Obligatory Shot with a Quarter

To make it more robust in my pocket, I encased the whole thing in two part epoxy.  I was careful to leave the solder bumps exposed and of course the USB leads.  A second layer of epoxy attached the solder braid for an attracive key ring.

It works and it cost $9.  Add in some gently used solder braid and some 5 minute epoxy and you have a $10 password storage key.