MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Encode

Method Encode

lib/base/base64.cpp:12–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10using namespace icinga;
11
12String Base64::Encode(const String& input)
13{
14 BIO *biomem = BIO_new(BIO_s_mem());
15 BIO *bio64 = BIO_new(BIO_f_base64());
16 BIO_push(bio64, biomem);
17 BIO_set_flags(bio64, BIO_FLAGS_BASE64_NO_NL);
18 BIO_write(bio64, input.CStr(), input.GetLength());
19 (void) BIO_flush(bio64);
20
21 char *outbuf;
22 long len = BIO_get_mem_data(biomem, &outbuf);
23
24 String ret = String(outbuf, outbuf + len);
25 BIO_free_all(bio64);
26
27 return ret;
28}
29
30String Base64::Decode(const String& input)
31{

Callers

nothing calls this directly

Calls 3

CStrMethod · 0.80
StringClass · 0.70
GetLengthMethod · 0.45

Tested by

no test coverage detected