1oath_base32_decode(3) liboath oath_base32_decode(3)
2
3
4
6 oath_base32_decode - API function
7
9 #include <oath.h>
10
11 int oath_base32_decode(const char * in, size_t inlen, char ** out,
12 size_t * outlen);
13
15 const char * in
16 input string with base32 encoded data of length inlen
17
18 size_t inlen
19 length of input base32 string in
20
21 char ** out pointer to output variable for binary data of length
22 outlen, or NULL
23
24 size_t * outlen
25 pointer to output variable holding length of out, or NULL
26
28 Decode a base32 encoded string into binary data.
29
30 Space characters are ignored and pad characters are added if needed.
31 Non-base32 data are not ignored but instead will lead to an OATH_IN‐
32 VALID_BASE32 error.
33
34 The in parameter should contain inlen bytes of base32 encoded data.
35 The function allocates a new string in *out to hold the decoded data,
36 and sets *outlen to the length of the data.
37
38 If out is NULL, then *outlen will be set to what would have been the
39 length of *out on successful encoding.
40
41 If the caller is not interested in knowing the length of the output
42 data out, then outlen may be set to NULL.
43
44 It is permitted but useless to have both out and outlen NULL.
45
47 On success OATH_OK (zero) is returned, OATH_INVALID_BASE32 is returned
48 if the input contains non-base32 characters, and OATH_MALLOC_ERROR is
49 returned on memory allocation errors.
50
52 1.12.0
53
55 Report bugs to <oath-toolkit-help@nongnu.org>. liboath home page:
56 https://www.nongnu.org/oath-toolkit/ General help using GNU software:
57 http://www.gnu.org/gethelp/
58
60 Copyright © 2009-2020 Simon Josefsson.
61 Copying and distribution of this file, with or without modification,
62 are permitted in any medium without royalty provided the copyright no‐
63 tice and this notice are preserved.
64
65
66
67liboath 2.6.7 oath_base32_decode(3)