8 #ifndef BOTAN_ONE_TIME_PASSWORDS_H_
9 #define BOTAN_ONE_TIME_PASSWORDS_H_
11 #include <botan/mac.h>
36 HOTP(
const uint8_t key[],
size_t key_len,
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;
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,
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;
TOTP(const SymmetricKey &key, const std::string &hash_algo="SHA-1", size_t digits=6, size_t time_step=30)
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
AlgorithmIdentifier hash_algo
HOTP(const SymmetricKey &key, const std::string &hash_algo="SHA-1", size_t digits=6)