Class TimeBasedOTPUtil


  • public class TimeBasedOTPUtil
    extends Object
    Utility class associated with the TimeBasedOTP class
    Since:
    Sep 20, 2010
    Author:
    Anil.Saldhana@redhat.com
    • Constructor Detail

      • TimeBasedOTPUtil

        public TimeBasedOTPUtil()
    • Method Detail

      • validate

        public static boolean validate​(String submittedOTP,
                                       byte[] secret,
                                       int numDigits)
                                throws GeneralSecurityException
        Validate a submitted OTP string
        Parameters:
        submittedOTP - OTP string to validate
        secret - Shared secret
        Returns:
        Throws:
        GeneralSecurityException
      • validate256

        public static boolean validate256​(String submittedOTP,
                                          byte[] secret,
                                          int numDigits)
                                   throws GeneralSecurityException
        Validate a submitted OTP string using HMAC_256
        Parameters:
        submittedOTP - OTP string to validate
        secret - Shared secret
        Returns:
        Throws:
        GeneralSecurityException
      • validate512

        public static boolean validate512​(String submittedOTP,
                                          byte[] secret,
                                          int numDigits)
                                   throws GeneralSecurityException
        Validate a submitted OTP string using HMAC_512
        Parameters:
        submittedOTP - OTP string to validate
        secret - Shared secret
        Returns:
        Throws:
        GeneralSecurityException