rpm  4.12.0.1
rpmbase64.h
Go to the documentation of this file.
1 /* base64 encoder/decoder based on public domain implementation
2  * by Chris Venter */
3 
4 #include <sys/types.h>
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 /* returns malloced base64 encoded string
11  * lines are split with \n characters to be nearest lower multiple of linelen
12  * if linelen/4 == 0 lines are not split
13  * if linelen < 0 default line length (64) is used
14  * the returned string is empty when len == 0
15  * returns NULL on failures
16  */
17 char *rpmBase64Encode(const void *data, size_t len, int linelen);
18 
19 /* decodes from zero terminated base64 encoded string to a newly malloced buffer
20  * ignores whitespace characters in the input string
21  * return values:
22  * 0 - OK
23  * 1 - input is NULL
24  * 2 - invalid length
25  * 3 - invalid characters on input
26  * 4 - malloc failed
27  */
28 int rpmBase64Decode(const char *in, void **out, size_t *outlen);
29 
30 /* counts CRC24 and base64 encodes it in a malloced string
31  * returns NULL on failures
32  */
33 char *rpmBase64CRC(const unsigned char *data, size_t len);
34 
35 #ifdef __cplusplus
36 }
37 #endif
char * rpmBase64CRC(const unsigned char *data, size_t len)
char * rpmBase64Encode(const void *data, size_t len, int linelen)
int rpmBase64Decode(const char *in, void **out, size_t *outlen)