|
libkeepass 0.2.0
KeePass key database importer/exporter library
|
Wrapper that marks a value as sensitive and tracks the protection flag of a KeePass field. More...
#include <security.hh>
Public Member Functions | |
| protect ()=default | |
| Default-constructs an empty protected wrapper. | |
| protect (const T &val, bool prot) | |
| Constructs a protected wrapper with an explicit protection flag. | |
| protect (T &&val, bool prot) | |
| Constructs a protected wrapper by moving a value in. | |
| protect (const protect< T > &other) | |
| Copy-constructs from another protected wrapper. | |
| protect (protect< T > &&other) noexcept | |
| Move-constructs from another protected wrapper. | |
| bool | is_protected () const |
| Returns whether the value is marked as sensitive. | |
| void | set_protected (bool prot) |
| Sets the protection flag. | |
| const T & | value () const |
| Returns a const reference to the stored value. | |
| void | set_value (const T &val) |
| Replaces the stored value. | |
| protect< T > & | operator= (const protect< T > &)=default |
| Copy-assigns from another protected wrapper. | |
| protect< T > & | operator= (protect< T > &&other) noexcept |
| Move-assigns from another protected wrapper. | |
| operator const T & () const | |
| Explicit conversion operator to the wrapped type. | |
| const T * | operator-> () const |
| Arrow operator forwarding to the stored value. | |
| const T & | operator* () const |
| Dereference operator forwarding to the stored value. | |
| bool | operator== (const protect< T > &other) const |
| Equality comparison of two protected wrappers. | |
| bool | operator!= (const protect< T > &other) const |
| Inequality comparison of two protected wrappers. | |
Wrapper that marks a value as sensitive and tracks the protection flag of a KeePass field.
The wrapped value is stored in plaintext; protection here means that the value is flagged as sensitive (e.g. a password) and is written to the KDBX output obfuscated through the inner random stream (Salsa20/ChaCha20). For secret text fields prefer protect<secure_string>, which additionally keeps the value on a non-swappable, zeroized heap buffer.
| T | The wrapped value type. |
|
inline |
Constructs a protected wrapper with an explicit protection flag.
| [in] | val | Initial value. |
| [in] | prot | Whether the value is sensitive. |
|
inline |
Constructs a protected wrapper by moving a value in.
| [in,out] | val | Initial value (moved from). |
| [in] | prot | Whether the value is sensitive. |
|
inline |
Copy-constructs from another protected wrapper.
| [in] | other | Source wrapper. |
|
inlinenoexcept |
Move-constructs from another protected wrapper.
| [in,out] | other | Source wrapper (moved from). |
|
inline |
Returns whether the value is marked as sensitive.
|
inlineexplicit |
Explicit conversion operator to the wrapped type.
|
inline |
Inequality comparison of two protected wrappers.
| [in] | other | Right-hand side. |
|
inline |
Dereference operator forwarding to the stored value.
|
inline |
Arrow operator forwarding to the stored value.
|
default |
Copy-assigns from another protected wrapper.
| [in] | other | Source wrapper. |
|
inlinenoexcept |
Move-assigns from another protected wrapper.
| [in,out] | other | Source wrapper (moved from). |
|
inline |
Equality comparison of two protected wrappers.
| [in] | other | Right-hand side. |
|
inline |
Sets the protection flag.
| [in] | prot | New protection state. |
|
inline |
Replaces the stored value.
| [in] | val | New value. |
|
inline |
Returns a const reference to the stored value.