libkeepass 0.2.0
KeePass key database importer/exporter library
Loading...
Searching...
No Matches
secure_io.hh File Reference

Sensitive-data wiping helpers. More...

#include <cstddef>
#include <sstream>
#include "libkeepass/secure.hh"

Go to the source code of this file.

Functions

void keepass::detail::WipeStream (std::stringstream &stream)
 
template<typename Container >
void keepass::detail::WipeBuffer (Container *buffer)
 

Detailed Description

Sensitive-data wiping helpers.

Function Documentation

◆ WipeBuffer()

template<typename Container >
void keepass::detail::WipeBuffer ( Container *  buffer)
inline

Zeroizes the contents of a contiguous container (std::string, std::string view or std::vector<char/uint8_t>) in place. std::string_view::data() is const even in C++17, so cast it away for the wipe; writing zeros never invalidates the container invariants.

◆ WipeStream()

void keepass::detail::WipeStream ( std::stringstream &  stream)
inline

Zeroizes the buffered content of a stringstream in place, so that decrypted plaintext or transient header material does not linger in the heap after parsing or encrypting.