|
libkeepass 0.2.0
KeePass key database importer/exporter library
|
A binary blob (e.g. an attachment payload) with an optional compression flag. More...
#include <binary.hh>
Public Member Functions | |
| Binary (const protect< secure_string > &data) | |
| Creates a binary from the given protected data. | |
| Binary (std::shared_ptr< const detail::BinarySource > source, bool protected_data, bool compress=false) | |
| Creates a lazy binary backed by a shared source. | |
| Binary (const Binary &other) | |
| Copy-constructs the payload/source state. | |
| Binary & | operator= (const Binary &other) |
| Copy-assigns the payload/source state. | |
| bool | Empty () const |
| Returns whether the binary data is empty. | |
| std::size_t | Size () const |
| Returns the size in bytes of the binary data. | |
| const protect< secure_string > & | data () const |
| Returns the binary data, loading it first if necessary. | |
| void | set_data (const protect< secure_string > &data) |
| Sets the binary data, replacing any lazy source. | |
| void | load () const |
| Loads a lazy payload into secure memory (no-op for materialized data). | |
| bool | is_loaded () const |
| Returns whether the payload is currently materialized in memory. | |
| bool | is_lazy () const |
| Returns whether the payload is backed by a lazy source. | |
| bool | is_protected () const |
| Returns whether the payload was stored with the protected flag. | |
| void | WriteTo (std::ostream &dst) const |
Writes the payload to dst, streaming it when it is still lazy. | |
| bool | compress () const |
| Returns whether the binary is stored compressed. | |
| void | set_compress (bool compress) |
| Sets whether the binary is stored compressed. | |
| bool | operator== (const Binary &other) const |
| Equality comparison (materializes lazy payloads). | |
| bool | operator!= (const Binary &other) const |
| Inequality comparison. | |
A binary blob (e.g. an attachment payload) with an optional compression flag.
A binary can either own its payload directly or reference a shared detail::BinarySource. Lazy binaries (used by the KDBX 4 importer for inner-header attachments) only copy their payload into secure memory when data is first accessed; WriteTo streams directly from the source.
| keepass::Binary::Binary | ( | std::shared_ptr< const detail::BinarySource > | source, |
| bool | protected_data, | ||
| bool | compress = false |
||
| ) |
Creates a lazy binary backed by a shared source.
| source | Payload source (must not be null). |
| protected_data | Whether the payload is flagged as protected. |
| compress | Whether the binary should be written compressed (KDBX 3). |