1oath_totp_generate2(3)              liboath             oath_totp_generate2(3)
2
3
4

NAME

6       oath_totp_generate2 - API function
7

SYNOPSIS

9       #include <oath.h>
10
11       int  oath_totp_generate2(const  char  *  secret,  size_t secret_length,
12       time_t now, unsigned time_step_size, time_t start_offset, unsigned dig‐
13       its, int flags, char * output_otp);
14

ARGUMENTS

16       const char * secret
17                   the shared secret string
18
19       size_t secret_length
20                   length of secret
21
22       time_t now  Unix time value to compute TOTP for
23
24       unsigned time_step_size
25                   time step system parameter (typically 30)
26
27       time_t start_offset
28                   Unix  time  of when to start counting time steps (typically
29                   0)
30
31       unsigned digits
32                   number of requested digits in the OTP, excluding checksum
33
34       int flags   flags indicating mode, one of oath_totp_flags
35
36       char * output_otp
37                   output buffer, must have room for the output OTP plus zero
38

DESCRIPTION

40       Generate a one-time-password using the time-variant TOTP algorithm  de‐
41       scribed in RFC 6238.  The input parameters are taken as time values.
42
43       The  system parameter time_step_size describes how long the time window
44       for each OTP is.  The recommended value is 30 seconds, and you can  use
45       the  value 0 or the symbol OATH_TOTP_DEFAULT_TIME_STEP_SIZE to indicate
46       this.
47
48       The system parameter start_offset denote the Unix time when time  steps
49       are started to be counted.  The recommended value is 0, to fall back on
50       the Unix epoch) and you can use the symbol OATH_TOTP_DEFAULT_START_TIME
51       to indicate this.
52
53       The  output_otp  buffer  must have room for at least digits characters,
54       plus one for the terminating NUL.
55
56       Currently only values 6, 7 and 8 for digits are  supported.   This  re‐
57       striction may be lifted in future versions.
58
59       The flags parameter may be used to change the MAC function, for example
60       OATH_TOTP_HMAC_SHA256 or OATH_TOTP_HMAC_SHA512.
61

RETURNS

63       On success, OATH_OK (zero) is returned, otherwise an error code is  re‐
64       turned.
65

SINCE

67       2.6.0
68

REPORTING BUGS

70       Report  bugs  to  <oath-toolkit-help@nongnu.org>.   liboath  home page:
71       https://www.nongnu.org/oath-toolkit/ General help using  GNU  software:
72       http://www.gnu.org/gethelp/
73
75       Copyright © 2009-2020 Simon Josefsson.
76       Copying  and  distribution  of this file, with or without modification,
77       are permitted in any medium without royalty provided the copyright  no‐
78       tice and this notice are preserved.
79
80
81
82liboath                              2.6.9              oath_totp_generate2(3)
Impressum