One-Tme Passwords

Objective

Implement and test a HMAC-Based or Time-Based One-Time Password (OTP) scheme as described in two RFCs. Analyze the security of the scheme.

Scenario

From RFC 4226:

One-Time Password is certainly one of the simplest and most popular forms of two-factor authentication for securing network access. For example, in large enterprises, Virtual Private Network access often requires the use of One-Time Password tokens for remote user authentication. One-Time Passwords are often preferred to stronger forms of authentication such as Public-Key Infrastructure (PKI) or biometrics because an air-gap device does not require the installation of any client desktop software on the user machine, therefore allowing them to roam across multiple machines including home computers, kiosks, and personal digital assistants.

RFC 4226 describes an OTP scheme based on the HMAC-SHA-1 algorithm in which the user's secret key and a counter value are combined using the HMAC to produce a OTP value. RFC 6238 extends RFC 4226 and describes an OTP algorithm in which the counter is replaced with the time in seconds since some initial time T0. We refer to the method in RFC 4226 as an HMAC-Based OTP or HOTP scheme; the method in RFC 6238 is called a Time-Based OTP or TOTP scheme.

Procedure

Review both RFCs and choose one of the two methods to implement. Develop and test your implementation. Lastly, analyze the security of the selected scheme.