What is the expert cryptographic opinion on the following?

Assume that there is a web server and a Client on web page who calls an OTP ([One-Time Password]) web service on the server which:

  1. creates a RSA key pair
  2. generates a random 10 digit string - the Message
  3. Encrypts the Message with the Public Key component to generate an OTP
  4. Returns the Message and Private Key to Client
  5. Sends OTP via an alternate channel (say SMS) to User on a mobile

The reason for this kludge is that the web service return can be a script that gets added to the DOM on the fly. The script contains the RSA decrypt method with a built-in Private Key and has the Message as the validator. When User enters the OTP into the web page, the validator succeeds or not.

The advantage in this method is that the OTP does not need to be stored in a server-side database, and there is only one web call-out with the browser doing the validation. However, I am unsure whether RSA was meant to have a private Public Key and a public Private Key.

What is the analysis on whether a malicious user can get the Private Key and Message and then compute the OTP? If so, then could I make the OTP entry time bound so as to minimize the attack possibility? Is there a better way to fulfill my requirements?

  • 2
    $\begingroup$ What, exactly, are your requirements? In particular, what is that you're trying to achieve with this scheme? It looks like you're trying to authenticate something to something else, but who or what exactly are the parties involves and their roles in this authentication? $\endgroup$ – Ilmari Karonen Jan 28 '13 at 15:56
  • $\begingroup$ I am trying to implement two-factor authentication. The User enters their standard password to access a web site at which point a token is sent via SMS to their mobile device. They enter the token as the second factor. I am trying to implement the second factor verification entirely on the web client. $\endgroup$ – MasterBlaster Jan 29 '13 at 2:51
  • 2
    $\begingroup$ And why should the server trust the results of whatever verification the client does (or claims to have done)? $\endgroup$ – Ilmari Karonen Jan 29 '13 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.