Class TOTP

java.lang.Object
io.gravitee.am.factor.otp.utils.TOTP

public final class TOTP extends Object
This is an example implementation of the OATH TOTP algorithm. Visit www.openauthentication.org for more information. See Appendix A. TOTP Algorithm: Reference Implementation
Author:
Johan Rydell, PortWise, Inc., Titouan COMPIEGNE (titouan.compiegne at graviteesource.com), GraviteeSource Team
  • Field Details

  • Method Details

    • generateTOTP

      public static String generateTOTP(String key, long time)
      This method generates a TOTP value for the given set of parameters.
      Parameters:
      key - : the shared secret, HEX encoded
    • generateTOTP

      public static String generateTOTP(String key, String time, String returnDigits)
      This method generates a TOTP value for the given set of parameters.
      Parameters:
      key - : the shared secret, HEX encoded
      time - : a value that reflects a time
      returnDigits - : number of digits to return
    • generateTOTP256

      public static String generateTOTP256(String key, String time, String returnDigits)
      This method generates a TOTP value for the given set of parameters.
      Parameters:
      key - : the shared secret, HEX encoded
      time - : a value that reflects a time
      returnDigits - : number of digits to return
      Returns:
      a numeric String in base 10 that includes digits
    • generateTOTP512

      public static String generateTOTP512(String key, String time, String returnDigits)
      This method generates a TOTP value for the given set of parameters.
      Parameters:
      key - : the shared secret, HEX encoded
      time - : a value that reflects a time
      returnDigits - : number of digits to return
    • generateTOTP

      public static String generateTOTP(String key, String time, String returnDigits, String crypto)
      This method generates a TOTP value for the given set of parameters.
      Parameters:
      key - : the shared secret, HEX encoded
      time - : a value that reflects a time
      returnDigits - : number of digits to return
      crypto - : the crypto function to use