Skip to content

Commit

Permalink
remove unused EncodeBase64Secure
Browse files Browse the repository at this point in the history
Also the hanging declaration of DecodeBase64Secure
  • Loading branch information
Fuzzbawls committed May 11, 2021
1 parent 690c938 commit ab830e5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 29 deletions.
27 changes: 0 additions & 27 deletions src/utilstrencodings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,33 +193,6 @@ std::string DecodeBase64(const std::string& str)
return (vchRet.size() == 0) ? std::string() : std::string((const char*)&vchRet[0], vchRet.size());
}

// Base64 encoding with secure memory allocation
SecureString EncodeBase64Secure(const SecureString& input)
{
// Init openssl BIO with base64 filter and memory output
BIO *b64, *mem;
b64 = BIO_new(BIO_f_base64());
BIO_set_flags(b64, BIO_FLAGS_BASE64_NO_NL); // No newlines in output
mem = BIO_new(BIO_s_mem());
BIO_push(b64, mem);

// Decode the string
BIO_write(b64, &input[0], input.size());
(void)BIO_flush(b64);

// Create output variable from buffer mem ptr
BUF_MEM* bptr;
BIO_get_mem_ptr(b64, &bptr);
SecureString output(bptr->data, bptr->length);

// Cleanse secure data buffer from memory
memory_cleanse((void*)bptr->data, bptr->length);

// Free memory
BIO_free_all(b64);
return output;
}

std::string EncodeBase32(const unsigned char* pch, size_t len)
{
static const char *pbase32 = "abcdefghijklmnopqrstuvwxyz234567";
Expand Down
2 changes: 0 additions & 2 deletions src/utilstrencodings.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ std::vector<unsigned char> DecodeBase64(const char* p, bool* pfInvalid = NULL);
std::string DecodeBase64(const std::string& str);
std::string EncodeBase64(const unsigned char* pch, size_t len);
std::string EncodeBase64(const std::string& str);
SecureString DecodeBase64Secure(const SecureString& input);
SecureString EncodeBase64Secure(const SecureString& input);
std::vector<unsigned char> DecodeBase32(const char* p, bool* pfInvalid = NULL);
std::string DecodeBase32(const std::string& str);
std::string EncodeBase32(const unsigned char* pch, size_t len);
Expand Down

0 comments on commit ab830e5

Please sign in to comment.