HMAC-based One-time Password algorithm

From HandWiki
Revision as of 04:12, 1 December 2022 by TextAI (talk | contribs) (link)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Short description: Password authentication algorithm

HMAC-based One-time Password algorithm (HOTP) is a one-time password (OTP) algorithm based on hash-based message authentication codes (HMAC). It is a cornerstone of the Initiative for Open Authentication (OATH).

HOTP was published as an informational IETF RFC 4226 in December 2005, documenting the algorithm along with a Java implementation. Since then, the algorithm has been adopted by many companies worldwide (see below). The HOTP algorithm is a freely available open standard.

Algorithm

The HOTP algorithm provides a method of authentication by symmetric generation of human-readable passwords, or values, each used for only one authentication attempt. The one-time property leads directly from the single use of each counter value.

Parties intending to use HOTP must establish some parameters; typically these are specified by the authenticator, and either accepted or not by the authenticated:

  • A cryptographic hash method, H (default is SHA-1)
  • A secret key, K, which is an arbitrary byte string, and must remain private
  • A counter, C, which counts the number of iterations
  • A HOTPvalue length, d (6–10, default is 6, and 6–8 is recommended)

Both parties compute the HOTPvalue derived from the secret key K and the counter C. Then the authenticator checks its locally-generated value against the value supplied by the authenticated.

The authenticator and the authenticated increment the counter, C, independently of each other, where the latter may increase ahead of the former, thus a resynchronisation protocol is wise. RFC 4226 doesn't actually require any such, but does make a recommendation. This simply has the authenticator repeatedly try verification ahead of their counter through a window of size, s. The authenticator's counter continues forward of the value at which verification succeeds, and requires no actions by the authenticated.

The recommendation is made that persistent throttling of HOTPvalue verification take place, to address their relatively small size and thus vulnerability to brute force attacks. It is suggested that verification be locked out after a small number of failed attempts, or that each failed attempt attracts an additional (linearly-increasing) delay.

6-digit codes are commonly provided by proprietary hardware tokens from a number of vendors informing the default value of d. Truncation extracts 31 bits or [math]\displaystyle{ \log_{10}\left(2^{31}\right) }[/math] ≈ 9.3 decimal digits, meaning, at most, d can be 10, with the 10th digit providing less extra variation, taking values of 0, 1, and 2 (i.e., 0.3 digits).

Bidirectional authentication

After verification, the authenticator can authenticate itself simply by generating the next HOTPvalue, returning it, and then the authenticated can generate their own HOTPvalue to verify it. Note that counters are guaranteed to be synchronised at this point in the process.

HOTPvalue

The HOTPvalue is the human-readable design output, a d-digit decimal number (without omission of leading 0s):

HOTPvalue = HOTP(K, C) mod 10d

That is, the value is the d least significant base-10 digits of HOTP.

HOTP is a truncation of the hash-based message authentication code (HMAC) of the counter, C (under the key, K, and hash function, H).

HOTP(K, C) = truncate(HMACH(K, C))

Truncation first takes the 4 least significant bits of the MAC and uses them as an offset, i.

truncate(MAC) = extract31(MAC, MAC[(19 × 8) + 4:(19 × 8) + 7] × 8)

That index i is used to select 31 bits from MAC, starting at bit i + 1.

extract31(MAC, i) = MAC[i + 1:i + (4 × 8) − 1]

Note that 31 bits is a single bit short of a 4-byte word. Thus, the value can be placed inside such a word without using the sign bit (the most significant bit). This is done to definitely avoid doing modular arithmetic on negative numbers, as this has many differing definitions and implementations.[1]

Tokens

Both hardware and software tokens are available from various vendors, for some of them see references below. Hardware tokens implementing OATH HOTP tend to be significantly cheaper than their competitors based on proprietary algorithms.[2] As of 2010, OATH HOTP hardware tokens can be purchased for a marginal price.[3] Some products can be used for strong passwords as well as OATH HOTP.[4]

Software tokens are available for (nearly) all major mobile/smartphone platforms (J2ME,[5] Android,[6][7] iPhone,[8] BlackBerry,[9] Maemo,[10] macOS,[11] and Windows Mobile[9]).

Reception

Although the reception from some of the computer press has been negative during 2004 and 2005,[12][13][14] after IETF adopted HOTP as RFC 4226 in December 2005, various vendors started to produce HOTP compatible tokens and/or whole authentication solutions.

According to a paper on strong authentication (entitled "Road Map: Replacing Passwords with OTP Authentication") published by Burton Group (a division of Gartner, Inc.) in 2010, "Gartner's expectation is that the hardware OTP form factor will continue to enjoy modest growth while smartphone OTPs will grow and become the default hardware platform over time."[2]

See also

References

  1. Frank, Hoornaert; David, Naccache; Mihir, Bellare; Ohad, Ranen. "HOTP: An HMAC-Based One-Time Password Algorithm". https://tools.ietf.org/html/rfc4226#section-5.3. 
  2. 2.0 2.1 Diodati, Mark (2010). "Road Map: Replacing Passwords with OTP Authentication". Burton Group. http://www.burtongroup.com/Research/PublicDocument.aspx?cid=2107. "Gartner's expectation is that the hardware OTP form factor will continue to enjoy modest growth while smartphone OTPs will grow and become the default hardware platform over time. ... If the organization does not need the extensive platform support, then OATH-based technology is likely a more cost-effective choice." 
  3. "Security Authentication Tokens - Entrust". Entrust. 2011. http://www.entrust.com/strong-authentication/identityguard/tokens/. "Priced at $5 per token, the Entrust IdentityGuard Mini Token demonstrates that secure, reliable hardware authentication can be had at an attractive price. ... OATH and DES/3DES algorithm support" 
  4. "Password sCrib Tokens - Smart Crib". Smart Crib. 2013. http://www.s-crib.com/s-crib/. "You can get a token typing 4 updatable passwords and 8 digit OATH HOTP codes for the price of £35, no strings attached." 
  5. "DS3 Launches OathToken Midlet Application". Data Security Systems Solutions. 2006-02-24. http://ds3global.com/index.php/en/news-a-events/news/97-securing-data-delivery-hassle-free-/. "Singapore, Friday, 24 February 2006 - Data Security Systems Solutions is pleased to announce the launch of OathToken Midlet application, an extension of DS3 flagship product - Authentication Server." 
  6. "Android Token". diamondz... AT googlemail.com (not a full address, no better info on author could be found). 2009. http://code.google.com/p/androidtoken/. "Android Token is a project to create OATH software tokens for the Android platform. Turning a mobile phone into a One Time Password (OTP) generation device which can be used in the place of hardware tokens. ... The project supports both HOTP (Event Tokens) and TOTP (Time Tokens) specifications. ... Code license: GNU GPL v3" 
  7. "StrongAuth". StrongAuth. 2010. http://www.androidzoom.com/android_applications/tools/strongauth_bmeq.html. "Time-based one-time passcode generator based on HOTP (RFC 4226)." 
  8. Cobbs, Archie L. (2010). "OATH Token". Archie L. Cobbs. http://code.google.com/p/oathtoken/. "OATH Token is a free and open-source software token for two-factor authentication on the iPhone. OATH Token implements the RFC 4226 HOTP/OATH algorithm standard and is not tied to any proprietary server software." 
  9. 9.0 9.1 "ActivIdentity Soft Tokens". ActivIdentity. 2010. http://www.actividentity.com/products/authenticationdevices/SoftTokens/. "All ActivIdentity Soft Tokens support the Initiative For Open Authentication (OATH) HMAC-Based One-Time Password (HOTP) algorithm. ... ActivIdentity Mobile Soft Tokens are available on leading handset operating systems, including BlackBerry®, Apple® iPhone®, Windows Mobile, and many other Java 2 Platform, Micro Edition (J2ME) enabled devices." 
  10. Whitbeck, Sean (2011). "OTP Generator for N900". Sean Whitbeck. http://maemo.org/packages/view/otp/. "OTP Generator for Maemo on the Nokia N900. Supports OATH tokens (HOTP,TOTP) as well as the Mobile-OTP algorithm." 
  11. "SecuriToken". Feel Good Software. 2011. http://www.feelgoodsoftware.com/. "SecuriToken is an RFC compliant application to create and manage multiple software tokens for the OS X platform. Turning your Mac into a One Time Password (OTP) generation device which can be used in the place of hardware tokens." 
  12. Kearns, Dave (2004-12-06). "Digging deeper into OATH doesn't look so good". Network World. http://www.networkworld.com/newsletters/dir/2004/1206id1.html. "It may be that OATH will amount to something someday, but so far, it appears to be a stalking horse for VeriSign and that's not a bandwagon we should thoughtlessly jump on." 
  13. Willoughby, Mark (2005-03-21). "No agreement on Oath authentication". Computerworld. http://www.computerworld.com/s/article/99273/No_agreement_on_Oath_authentication. 
  14. Kaliski, Burt (2005-05-19). "Algorithm agility and OATH". Computerworld. http://www.computerworld.com/s/article/101788/Algorithm_agility_and_OATH. "Nevertheless, there is still good reason to question whether HOTP is suitable as a standard algorithm for OTP generation, and, more generally, whether such a standard algorithm is even necessary at all." 

External links