8#ifndef BOTAN_ONE_TIME_PASSWORDS_H_
9#define BOTAN_ONE_TIME_PASSWORDS_H_
27 HOTP(
const SymmetricKey& key, std::string_view hash_algo =
"SHA-1",
size_t digits = 6) :
28 HOTP(key.begin(), key.size(), hash_algo, digits) {}
36 HOTP(
const uint8_t key[],
size_t key_len,
37 std::string_view hash_algo =
"SHA-1",
44 uint32_t generate_hotp(uint64_t counter);
56 std::pair<bool,uint64_t> verify_hotp(uint32_t otp, uint64_t starting_counter,
size_t resync_range = 0);
58 std::unique_ptr<MessageAuthenticationCode> m_mac;
75 std::string_view hash_algo =
"SHA-1",
76 size_t digits = 6,
size_t time_step = 30) :
77 TOTP(key.begin(), key.size(), hash_algo, digits, time_step) {}
86 TOTP(
const uint8_t key[],
size_t key_len,
87 std::string_view hash_algo =
"SHA-1",
89 size_t time_step = 30);
94 uint32_t generate_totp(std::chrono::system_clock::time_point time_point);
100 uint32_t generate_totp(uint64_t unix_time);
102 bool verify_totp(uint32_t otp,
103 std::chrono::system_clock::time_point time,
104 size_t clock_drift_accepted = 0);
106 bool verify_totp(uint32_t otp, uint64_t unix_time,
107 size_t clock_drift_accepted = 0);
112 std::chrono::system_clock::time_point m_unix_epoch;
HOTP(const SymmetricKey &key, std::string_view hash_algo="SHA-1", size_t digits=6)
TOTP(const SymmetricKey &key, std::string_view hash_algo="SHA-1", size_t digits=6, size_t time_step=30)
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)