1oath_totp_validate4(3) liboath oath_totp_validate4(3)
2
3
4
6 oath_totp_validate4 - API function
7
9 #include <oath.h>
10
11 int oath_totp_validate4(const char * secret, size_t secret_length,
12 time_t now, unsigned time_step_size, time_t start_offset, size_t win‐
13 dow, int * otp_pos, uint64_t * otp_counter, int flags, const char *
14 otp);
15
17 const char * secret
18 the shared secret string
19
20 size_t secret_length
21 length of secret
22
23 time_t now Unix time value to validate TOTP for
24
25 unsigned time_step_size
26 time step system parameter (typically 30)
27
28 time_t start_offset
29 Unix time of when to start counting time steps (typically
30 0)
31
32 size_t window
33 how many OTPs after/before start OTP to test
34
35 int * otp_pos
36 output search position in search window (may be NULL).
37
38 uint64_t * otp_counter
39 counter value used to calculate OTP value (may be NULL).
40
41 int flags flags indicating mode, one of oath_totp_flags
42
43 const char * otp
44 the OTP to validate.
45
47 Validate an OTP according to OATH TOTP algorithm per RFC 6238.
48
49 Currently only OTP lengths of 6, 7 or 8 digits are supported. This re‐
50 strictions may be lifted in future versions, although some limitations
51 are inherent in the protocol.
52
53 The flags parameter may be used to change the MAC function, for example
54 OATH_TOTP_HMAC_SHA256 or OATH_TOTP_HMAC_SHA512.
55
57 Returns absolute value of position in OTP window (zero is first posi‐
58 tion), or OATH_INVALID_OTP if no OTP was found in OTP window, or an er‐
59 ror code.
60
62 2.6.0
63
65 Report bugs to <oath-toolkit-help@nongnu.org>. liboath home page:
66 https://www.nongnu.org/oath-toolkit/ General help using GNU software:
67 http://www.gnu.org/gethelp/
68
70 Copyright © 2009-2020 Simon Josefsson.
71 Copying and distribution of this file, with or without modification,
72 are permitted in any medium without royalty provided the copyright no‐
73 tice and this notice are preserved.
74
75
76
77liboath 2.6.7 oath_totp_validate4(3)