32#ifndef SECU_STRING_HPP
33#define SECU_STRING_HPP
35#include "../my_config.h"
91 bool operator != (
const std::string & ref)
const {
return ! (*
this == ref); };
92 bool operator != (
const secu_string & ref)
const {
return ! (*
this == ref); };
93 bool operator == (
const std::string &ref)
const;
104 void set(
int fd, U_I size);
154 void set_size(U_I size);
184 bool compare_with(
const char *ptr, U_I size)
const;
185 void clean_and_destroy();
void resize(U_I size)
clear and resize the string to the defined allocated size
void append_at(U_I offset, const char *ptr, U_I size)
append some data to the string at a given offset
void append(int fd, U_I size)
append some data at the end of the string
bool empty() const
tell whether string is empty
const char * c_str() const
get access to the secure string
U_I get_allocated_size() const
get the size of the allocated secure space
void set(int fd, U_I size)
fill the object with data
secu_string(const secu_string &ref)
the copy constructor
void randomize(U_I size)
set the string to randomize string of given size
~secu_string() noexcept
the destructor (set memory to zero before releasing it)
secu_string(const char *ptr, U_I size)
constructor 2
U_I get_size() const
get the size of the string
secu_string & operator=(const secu_string &ref)
the assignment operator
void clear()
clear the string (set to an empty string)
char & operator[](U_I index)
get access to the secure string by index
secu_string(secu_string &&ref) noexcept
the move constructor
void append_at(U_I offset, int fd, U_I size)
append some data to the string
void expand_string_size_to(U_I size)
set the string size within the allocated secure memory
secu_string(U_I storage_size=0)
constructor 1
static bool is_string_secured()
to know if secure memory is available
U_I * allocated_size
stores the allocated size of the secu_string
char * mem
pointer to allocated block of data
U_I * string_size
stores the string info size in the secu string (*string_size < *allocated_size)
bool zero_length
true if none of the other field are set due to zero byte length string requested
char * get_array()
non constant flavor of direct secure memory access
void reduce_string_size_to(U_I pos)
void append(const char *ptr, U_I size)
append some data at the end of the string
void init(U_I size)
to be used at creation time or after clean_and_destroy() only
void copy_from(const secu_string &ref)
to be used at creation time or after clean_and_destroy() only
contains all the excetion class thrown by libdar
are defined here basic integer types that tend to be portable
libdar namespace encapsulate all libdar symbols