Botan 3.6.1
Crypto and TLS for C&
|
#include <otp.h>
Public Member Functions | |
uint32_t | generate_hotp (uint64_t counter) |
HOTP (const SymmetricKey &key, std::string_view hash_algo="SHA-1", size_t digits=6) | |
HOTP (const uint8_t key[], size_t key_len, std::string_view hash_algo="SHA-1", size_t digits=6) | |
std::pair< bool, uint64_t > | verify_hotp (uint32_t otp, uint64_t starting_counter, size_t resync_range=0) |
|
inline |
key | the secret key shared between client and server |
hash_algo | the hash algorithm to use, should be SHA-1 or SHA-256 |
digits | the number of digits in the OTP (must be 6, 7, or 8) |
Botan::HOTP::HOTP | ( | const uint8_t | key[], |
size_t | key_len, | ||
std::string_view | hash_algo = "SHA-1", | ||
size_t | digits = 6 ) |
key | the secret key shared between client and server |
key_len | length of key param |
hash_algo | the hash algorithm to use, should be SHA-1 or SHA-256 |
digits | the number of digits in the OTP (must be 6, 7, or 8) |
Definition at line 15 of file hotp.cpp.
References BOTAN_ARG_CHECK, and Botan::MessageAuthenticationCode::create_or_throw().
uint32_t Botan::HOTP::generate_hotp | ( | uint64_t | counter | ) |
Generate the HOTP for a particular counter value
Definition at line 43 of file hotp.cpp.
References Botan::load_be().
Referenced by Botan::TOTP::generate_totp(), verify_hotp(), and Botan::TOTP::verify_totp().
std::pair< bool, uint64_t > Botan::HOTP::verify_hotp | ( | uint32_t | otp, |
uint64_t | starting_counter, | ||
size_t | resync_range = 0 ) |
Check an OTP value using a starting counter and a resync range
otp | the client provided OTP |
starting_counter | the server's guess as to the current counter state |
resync_range | if 0 then only HOTP(starting_counter) is accepted If larger than 0, up to resync_range values after HOTP are also checked. |
Definition at line 52 of file hotp.cpp.
References generate_hotp().