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

Output streambuf that writes HMAC-authenticated, block-structured data (KDBX4 format). More...

#include <stream.hh>

Inheritance diagram for keepass::hmac_ostreambuf:

Public Member Functions

 hmac_ostreambuf (std::ostream &dst, const uint8_t *hmac_key)
 Constructs an HMAC-signing output streambuf with the default 1 MiB block size.
 
 hmac_ostreambuf (std::ostream &dst, const uint8_t *hmac_key, uint32_t block_size)
 Constructs an HMAC-signing output streambuf with a custom block size.
 
 ~hmac_ostreambuf ()
 Zeroizes the stored master HMAC key.
 
int overflow (int c) override
 Buffers a character; flushes the current block when it reaches capacity.
 
int sync () override
 Flushes any buffered data and writes the trailing empty end-of-stream block.
 

Detailed Description

Output streambuf that writes HMAC-authenticated, block-structured data (KDBX4 format).

Each block is written with a 32-byte HMAC-SHA256 over the block index, block size, and block data. A trailing empty block is written on sync to signal end-of-stream.

Constructor & Destructor Documentation

◆ hmac_ostreambuf() [1/2]

keepass::hmac_ostreambuf::hmac_ostreambuf ( std::ostream &  dst,
const uint8_t *  hmac_key 
)
inline

Constructs an HMAC-signing output streambuf with the default 1 MiB block size.

Parameters
dstThe output stream to write HMAC-protected blocks to.
hmac_keyThe 512-bit master HMAC key.

◆ hmac_ostreambuf() [2/2]

keepass::hmac_ostreambuf::hmac_ostreambuf ( std::ostream &  dst,
const uint8_t *  hmac_key,
uint32_t  block_size 
)
inline

Constructs an HMAC-signing output streambuf with a custom block size.

Parameters
dstThe output stream to write HMAC-protected blocks to.
hmac_keyThe 512-bit master HMAC key.
block_sizeThe maximum number of data bytes per block.

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