4 * Copyright (c) 2015 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef QEMU_BASE64_H__
22 #define QEMU_BASE64_H__
24 #include "qemu-common.h"
29 * @input: the (possibly) base64 encoded text
30 * @in_len: length of @input or -1 if NUL terminated
31 * @out_len: filled with length of decoded data
32 * @errp: pointer to a NULL-initialized error object
34 * Attempt to decode the (possibly) base64 encoded
35 * text provided in @input. If the @input text may
36 * contain embedded NUL characters, or may not be
37 * NUL terminated, then @in_len must be set to the
38 * known size of the @input buffer.
40 * Note that embedded NULs, or lack of a NUL terminator
41 * are considered invalid base64 data and errors
42 * will be reported to this effect.
44 * If decoding is successful, the decoded data will
45 * be returned and @out_len set to indicate the
46 * number of bytes in the decoded data. The caller
47 * must use g_free() to free the returned data when
48 * it is no longer required.
50 * Returns: the decoded data or NULL
52 uint8_t *qbase64_decode(const char *input
,
58 #endif /* QEMU_BUFFER_H__ */