Class SecureRandomSecretGenerator
java.lang.Object
com.irurueta.authserver.authorization.domain.totp.SecureRandomSecretGenerator
- All Implemented Interfaces:
SecretGenerator
Creates 160-bit secrets, the length RFC 4226 recommends for HMAC-SHA1, from a
SecureRandom.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final SecureRandomSource of randomness.static final intLength of a secret in bytes, which is 160 bits. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
SECRET_BYTES
public static final int SECRET_BYTESLength of a secret in bytes, which is 160 bits.- See Also:
-
random
Source of randomness.
-
-
Constructor Details
-
SecureRandomSecretGenerator
public SecureRandomSecretGenerator()
-
-
Method Details
-
generate
public byte[] generate()Creates an unguessable secret.- Specified by:
generatein interfaceSecretGenerator- Returns:
SECRET_BYTESrandom bytes.
-