libkeepass 0.2.0
KeePass key database importer/exporter library
Loading...
Searching...
No Matches
keepass::KdbxXml Class Referencefinal

Parses and serializes the KDBX XML body. More...

#include <kdbx_xml.hh>

Public Types

using BinaryPool = std::unordered_map< std::string, std::shared_ptr< Binary > >
 
using IconPool = std::unordered_map< std::string, std::weak_ptr< Icon > >
 
using GroupPool = std::unordered_map< std::string, std::shared_ptr< Group > >
 

Public Member Functions

void set_kdbx4 (bool kdbx4)
 True while reading or writing a KDBX 4 database.
 
bool kdbx4 () const
 
void set_kdbx41 (bool kdbx41)
 True while writing KDBX 4.1 (0x00040001).
 
bool kdbx41 () const
 
void set_resource_limits (const detail::ResourceLimits &limits)
 Sets the resource budgets enforced while parsing the XML body.
 
const detail::ResourceLimits & resource_limits () const
 The resource budgets currently enforced while parsing.
 
void Reset ()
 Resets all internal pools and state for a new import/export operation.
 
BinaryPool & binary_pool ()
 
std::array< uint8_t, 32 > & header_hash ()
 
const std::array< uint8_t, 32 > & header_hash () const
 
void Parse (std::istream &src, RandomObfuscator &obfuscator, Database &db)
 Parses the full KDBX XML body from a stream.
 
void Write (std::ostream &dst, RandomObfuscator &obfuscator, const Database &db)
 Writes the full KDBX XML body to a stream.
 

Detailed Description

Parses and serializes the KDBX XML body.

The KDBX XML body contains the metadata (including custom icons and, for KDBX 3, the binary attachments), the groups with their entries and the deleted-objects tombstones. This class owns the pools (binaries, icons and groups by UUID reference) that are shared between the metadata, groups and the KDBX 4 inner header handling in KdbxFile.

The class is closely tied to KdbxFile, which drives the outer header, decryption and inner-header processing; it is used only internally by the library.

Member Function Documentation

◆ binary_pool()

BinaryPool & keepass::KdbxXml::binary_pool ( )
inline

Binary attachments referenced by entries and collected by the KDBX 4 inner-header processing in KdbxFile.

◆ header_hash()

std::array< uint8_t, 32 > & keepass::KdbxXml::header_hash ( )
inline

Header hash as carried inside the KDBX XML document (KDBX 3 only). The outer header processing in KdbxFile verifies resp. provides this value.

◆ Parse()

void keepass::KdbxXml::Parse ( std::istream &  src,
RandomObfuscator &  obfuscator,
Database &  db 
)

Parses the full KDBX XML body from a stream.

Parameters
srcThe input stream containing the XML body.
obfuscatorThe random stream obfuscator for decryption.
dbThe database to populate with parsed data.

◆ Write()

void keepass::KdbxXml::Write ( std::ostream &  dst,
RandomObfuscator &  obfuscator,
const Database &  db 
)

Writes the full KDBX XML body to a stream.

Parameters
dstThe output stream to write the XML body to.
obfuscatorThe random stream obfuscator for encryption.
dbThe database to serialize.

The documentation for this class was generated from the following file: