Skip to content

Instantly share code, notes, and snippets.

Created Oct 10, 2012
What would you like to do?
AeroGear Security OTP

AeroGear Security OTP - draft 0.0.1

This is a initial proposal on having a two factor authentication layer on mobile applications.


Scenarios - v0.0.1

Random Generation: secrets are generated randomly at provisioning stage and must be stored immediately and kept secure during their life cycle. - RFC 4226


After installing the application, the user will be able to create your own account. Before the HTTP request is sent to the server, mobile application applies a key derivation function which generates the secret shared key (SHA-1, SHA-256 or SHA-512) based on RFC 2898:

Secret shared key: user data + time + interval


  • user data: login, password
  • time: current time (UTC)
  • interval: represents the time in seconds, since the elapsed time.

The secret key will be stored on device for the calculation of a one-time password value. When the first request comes to the server it runs the same algorithm to generate the secret, store it and validate the OTP.



After a user has entered the login and password, mobile application will retrieve the secret from storage for the OTP calculation and send it back to the server. The server will retrieve the secret locally and validate the OTP.


Scenarios - v0.0.2

Deterministic Generation: secrets are derived from a master seed, both at provisioning and verification stages and generated on-the-fly whenever it is required. - RFC 4226



Shared Secret key expiration


Proposed roadmap

Note: I'd like to have it on the specific projects roadmap.

AeroGear Security (server)


  • Integration with PicketBox
  • Add OTP validation to our endpoints
  • Improve our persistence model to store the secret key

iOS, Android & JavaScript


  • Start the implementation of OTP storage
  • Generate dynamic secrets
  • OTP generation
  • Register users against our current endpoints


  • Bug fixes and improvements based on feedback
  • Integration with the current libraries
  • PoC with our current TODO app
  • Start PhoneGap plugin


  • Rebase against the master
  • Project documentation
  • PhoneGap plugin improvements


  • API review and improvements
  • Examples and documentation review

Common questions

  • How it will affect Android, iOS and JavaScript projects?

These libraries are optional and the development will be done in parallel in a separated branch.

  • Who will be on it?

abstractj the slacker and of course anyone who wants to help with code review, test and documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment