3

I have a situation where I need time based OTP.

But most of the examples and cases I have seen, uses same key to create and check otp.

But I need something different. I want to create OTP using a public key, so that it can only be checked/decrypted using private key only.

Is there any method like this?

  • 1
    Why do you want this? What is the actual problem you are trying to solve? – Sjoerd May 24 '17 at 11:11
  • Because OTP will be generated at client's side, and I will be using that OTP for further encryption – dilettante_aficionado May 24 '17 at 11:20
  • Why don't you use current system time ? – ifexploit May 24 '17 at 11:26
  • Because I need to decrypt it too, if I use the current system time, I won't have that information at the server side to decrypt it. – dilettante_aficionado May 24 '17 at 11:35
  • 1
    Encrypt the file and the current time both using the public key, the same can be decrypted at the server end. – ifexploit May 24 '17 at 13:37
  • if you have a pubkey setup, you don't need any special keys; just send a fresh symmetric key... – dandavis May 25 '17 at 07:39
  • @kadamb Are you talking about a One-Time-Pad to do encryption or about a One-Time-Password to do authentication? – cornelinux May 27 '17 at 10:43
  • I came here because we want to use TOTP as a second factor for connecting to our VPN. With RSA asymmetric crypto, we don't have to give the private key to the VPN server (just sign the CSR). With TOTP, we have to give the private key to the VPN server. This means that it's easier for an admin to auth as (impersonate) another user. If there was some asymmetric, CSR-like approach for TOTP auth, then this would mean an admin on our vpn server couldn't see a user's TOTP secret keys. – Michael Altfield Feb 16 '21 at 17:29

2 Answers2

6

In case you are talking about a One Time Password there is a simple reason, why TOTP-Algorithms are using a symmetric key on the client/device and the server side.

If you take a look at HOTP-TOTP (RFC6238), it is derived fro HOTP-OTP (RFC4226), the event based OTP algorithm. This was specified in 2005. The first smartphone arived in 2007.

So what? The OTP algorithms are designed to work with hardware devices. These hardware devices have a display, so that the user can punch in the one time password. During the generation of the one time password the RFC defines a truncation method, so that the user is actually able to punch in a limited set of characters. The output of HMAC-SHA1 is 20 bytes hexcode. Noone wants to enter this as a one time password.

To be able to do assymmetric cryptography you can not use any truncation function. Otherwise the public key would not be able to verify the signature. The private key would not be able to decrypt the message. The data to transfer with assymmetric keys would be much larger - 1024 bit, 2048 bit... Again, the user would have to enter manually a very long one time password.

Well, if the client transmits this data electonically you would not have to truncate it. But then we are again not talking about one time passwords but about publy key crypto or client certificate based authentication.

So in the end it is all about human readability and truncation.

cornelinux
  • 1,993
  • 8
  • 11
2

I have a situation where I need time based OTP.

First let's recollect the basis of Time-based OTP (or) Time-Synchronized OTP. A TOTP uses TIME (real-time clock) of the client in the process of OTP generation. So, it is safe to say that the "time" factor is a public key and a private key.

But most of the examples and cases I have seen, uses same key to create and check otp

This query completely contradicts the TOTP concept, correct me if I'm wrong. Later, you claim you need something different, If I understood this correctly, You want the OTP to be generated using Time of the client, The server is aware of the client's local time... This way the OTP generated by user (entered in client) is authenticated by the server. But you want it checked by a private key which is nothing but the server's synchronization of client local-time. So, please stop referring public key/private key with TOTP as

Time (local-time of client) is used in generation and checking of the OTP itself.

edit: (after reading comments) The Server needs to have a synchronization with the client local time, or the TOTP concept fails... I cannot stress the facts beyond this.

Adib N
  • 100
  • 6
  • "The Server needs to have a synchronization with the client local time"...yeah I am aware of that, I have figured out a solution, I will put my answer, after confirming it. – dilettante_aficionado May 24 '17 at 11:51
  • You just might be inventing a new security solution with your approach, I am looking forward to it! – Adib N May 24 '17 at 12:27