I have updated the Google Code project at
http://code.google.com/p/yubico-php-lib/ with all the code I've been working on. Here's a brief intro:
- ModHex class - lets anyone convert to/from ModHex
- Yubikey class - decodes a Yubikey into a useful array of values
- YubiAuthenticator - performs the standard validations per the cookbook, including private ID, counter, and timestamp. You extend this class to work with your own backend to store OTP data.
Documentation and a new zip file are available - the documention is also here:
http://yubico-php-lib.googlecode.com/fi ... c-0.1.htmlPlease ContributeI'm not a PHP ace, so if someone could help me make it better, please do. Areas that need work:
- More efficient OTP processing
- Extended counter validation
- The timer code is pretty weak, and could use some help
Thoughts and criticism welcome.
Quick HOW-TO GuideBased on the SQLite example.
- Populate a database with users and their public IDs and Yubikey AES keys and counters.
- Subclass AuthData into UserAuthData and add a $user field to it.
- Subclass YubiAuthenticator to use an UPDATE query in updateAuthData for storing OTP data.
- Get a username and OTP from a user.
- Create a new UserAuthData object and set the $user field to the username.
- Use a SELECT to get the AES key based on the username.
- Populate the UserAuthData object with the AES key.
- Call authenticate() to verify the user and their counter.
- If the result is SUCCESS, then all the checks were passed.