Cipherpack v1.2.0-dirty
A Cryprographic Stream Processor
Public Member Functions | List of all members
cipherpack::PackHeader Class Reference

Cipherpack header less encrypted keys or signatures as described in Cipherpack Data Stream. More...

#include <cipherpack.hpp>

Collaboration diagram for cipherpack::PackHeader:

Public Member Functions

 PackHeader ()
 default ctor, denoting an invalid package header. More...
 
 PackHeader (const jau::fraction_timespec &ts_creation)
 ctor, denoting an invalid package header. More...
 
 PackHeader (const std::string &_target_path, const uint64_t &_plaintext_size, const jau::fraction_timespec &_ts_creation, const std::string &_subject, const std::string &_pversion, const std::string &_pversion_parent, const CryptoConfig &_crypto_cfg, const std::vector< uint8_t > &_sender_fingerprint, const std::vector< std::vector< uint8_t > > &_recevr_fingerprints, const size_t _used_recevr_key_idx, const bool _valid)
 Complete ctor, denoting a complete package header, see Cipherpack Data Stream. More...
 
constexpr const jau::fraction_timespec & creation_time () const noexcept
 Returns the creation time since Unix epoch, see Cipherpack Data Stream. More...
 
constexpr const CryptoConfigcrypto_config () const noexcept
 
bool isValid () const noexcept
 
const std::vector< uint8_t > & plaintext_hash () const noexcept
 Return optional hash value of the plaintext message, produced for convenience and not wired. More...
 
const std::string & plaintext_hash_algo () const noexcept
 Return optional hash algorithm for the plaintext message, produced for convenience and not wired. More...
 
uint64_t plaintext_size () const noexcept
 Returns the plaintext message size in bytes, zero if not determined yet. More...
 
constexpr const std::string & plaintext_version () const noexcept
 Returns version of this plaintext message, user semantic, see Cipherpack Data Stream. More...
 
constexpr const std::string & plaintext_version_parent () const noexcept
 Returns version of this plaintext message's preceding message, user semantic, see Cipherpack Data Stream. More...
 
const std::vector< std::vector< uint8_t > > & receiver_fingerprints () const noexcept
 Return the list of receiver's public-keys fingerprints used to encrypt the symmetric-key, see Cipherpack Data Stream. More...
 
ssize_t receiver_key_index () const noexcept
 Return the index of the matching receiver's public-key fingerprint used to decrypt the symmetric-key, see Cipherpack Data Stream. More...
 
const std::vector< uint8_t > & sender_fingerprint () const noexcept
 Return the sender's public-key fingerprint used to sign, see Cipherpack Data Stream. More...
 
void set_plaintext_hash (const std::string &algo, const std::vector< uint8_t > &hash) noexcept
 Set optional hash-algo and -value of the plaintext messages, produced for convenience and not wired. More...
 
void set_plaintext_size (const uint64_t v) noexcept
 
void setValid (const bool v)
 
constexpr const std::string & subject () const noexcept
 Returns the designated subject of message, see Cipherpack Data Stream. More...
 
const std::string & target_path () const noexcept
 Returns the designated target path for this plaintext message, see Cipherpack Data Stream. More...
 
std::string to_string (const bool show_crypto_algos=false, const bool force_all_fingerprints=false) const noexcept
 Return a string representation. More...
 

Detailed Description

Cipherpack header less encrypted keys or signatures as described in Cipherpack Data Stream.

See also
Cipherpack Overview
Cipherpack Data Stream
Examples
commandline.cpp, and test_01_cipherpack.cpp.

Definition at line 275 of file cipherpack.hpp.

Constructor & Destructor Documentation

◆ PackHeader() [1/3]

cipherpack::PackHeader::PackHeader ( )
inline

default ctor, denoting an invalid package header.

Definition at line 293 of file cipherpack.hpp.

◆ PackHeader() [2/3]

cipherpack::PackHeader::PackHeader ( const jau::fraction_timespec &  ts_creation)
inline

ctor, denoting an invalid package header.

Definition at line 310 of file cipherpack.hpp.

◆ PackHeader() [3/3]

cipherpack::PackHeader::PackHeader ( const std::string &  _target_path,
const uint64_t &  _plaintext_size,
const jau::fraction_timespec &  _ts_creation,
const std::string &  _subject,
const std::string &  _pversion,
const std::string &  _pversion_parent,
const CryptoConfig _crypto_cfg,
const std::vector< uint8_t > &  _sender_fingerprint,
const std::vector< std::vector< uint8_t > > &  _recevr_fingerprints,
const size_t  _used_recevr_key_idx,
const bool  _valid 
)
inline

Complete ctor, denoting a complete package header, see Cipherpack Data Stream.

Definition at line 327 of file cipherpack.hpp.

Member Function Documentation

◆ target_path()

const std::string & cipherpack::PackHeader::target_path ( ) const
inlinenoexcept

Returns the designated target path for this plaintext message, see Cipherpack Data Stream.

Examples
commandline.cpp.

Definition at line 352 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ plaintext_size()

uint64_t cipherpack::PackHeader::plaintext_size ( ) const
inlinenoexcept

Returns the plaintext message size in bytes, zero if not determined yet.

See Cipherpack Data Stream.

Examples
test_01_cipherpack.cpp.

Definition at line 355 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ set_plaintext_size()

void cipherpack::PackHeader::set_plaintext_size ( const uint64_t  v)
inlinenoexcept

Definition at line 357 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ creation_time()

constexpr const jau::fraction_timespec & cipherpack::PackHeader::creation_time ( ) const
inlineconstexprnoexcept

Returns the creation time since Unix epoch, see Cipherpack Data Stream.

Definition at line 360 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ subject()

constexpr const std::string & cipherpack::PackHeader::subject ( ) const
inlineconstexprnoexcept

Returns the designated subject of message, see Cipherpack Data Stream.

Definition at line 363 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ plaintext_version()

constexpr const std::string & cipherpack::PackHeader::plaintext_version ( ) const
inlineconstexprnoexcept

Returns version of this plaintext message, user semantic, see Cipherpack Data Stream.

Definition at line 366 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ plaintext_version_parent()

constexpr const std::string & cipherpack::PackHeader::plaintext_version_parent ( ) const
inlineconstexprnoexcept

Returns version of this plaintext message's preceding message, user semantic, see Cipherpack Data Stream.

Definition at line 369 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ crypto_config()

constexpr const CryptoConfig & cipherpack::PackHeader::crypto_config ( ) const
inlineconstexprnoexcept

Definition at line 371 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ sender_fingerprint()

const std::vector< uint8_t > & cipherpack::PackHeader::sender_fingerprint ( ) const
inlinenoexcept

Return the sender's public-key fingerprint used to sign, see Cipherpack Data Stream.

Definition at line 376 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ receiver_fingerprints()

const std::vector< std::vector< uint8_t > > & cipherpack::PackHeader::receiver_fingerprints ( ) const
inlinenoexcept

Return the list of receiver's public-keys fingerprints used to encrypt the symmetric-key, see Cipherpack Data Stream.

Definition at line 381 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ receiver_key_index()

ssize_t cipherpack::PackHeader::receiver_key_index ( ) const
inlinenoexcept

Return the index of the matching receiver's public-key fingerprint used to decrypt the symmetric-key, see Cipherpack Data Stream.

Returns
the receiver's key index of getReceiverFingerprints(), or -1 if not found or not decrypting.

Definition at line 388 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ plaintext_hash_algo()

const std::string & cipherpack::PackHeader::plaintext_hash_algo ( ) const
inlinenoexcept

Return optional hash algorithm for the plaintext message, produced for convenience and not wired.

If not used, returned string is empty.

See also
getPlaintextHash()
setPlaintextHash()
Examples
commandline.cpp, and test_01_cipherpack.cpp.

Definition at line 398 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ plaintext_hash()

const std::vector< uint8_t > & cipherpack::PackHeader::plaintext_hash ( ) const
inlinenoexcept

Return optional hash value of the plaintext message, produced for convenience and not wired.

If not used, i.e. getPlaintextHashAlgo() is empty, returned vector has zero size.

See also
getPlaintextHashAlgo()
setPlaintextHash()
Examples
commandline.cpp, and test_01_cipherpack.cpp.

Definition at line 408 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ set_plaintext_hash()

void cipherpack::PackHeader::set_plaintext_hash ( const std::string &  algo,
const std::vector< uint8_t > &  hash 
)
inlinenoexcept

Set optional hash-algo and -value of the plaintext messages, produced for convenience and not wired.

See also
getPlaintextHash()
getPlaintextHashAlgo()

Definition at line 415 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ to_string()

std::string PackHeader::to_string ( const bool  show_crypto_algos = false,
const bool  force_all_fingerprints = false 
) const
noexcept

Return a string representation.

Parameters
show_crypto_algospass true if used crypto algos shall be shown, otherwise suppressed (default).
force_all_fingerprintsif true always show all getTermKeysFingerprint(), otherwise show only the getTermKeysFingerprint() if >= 0 (default).
Returns
string representation
Examples
commandline.cpp, and test_01_cipherpack.cpp.

Definition at line 147 of file crypto0.cpp.

Here is the caller graph for this function:

◆ setValid()

void cipherpack::PackHeader::setValid ( const bool  v)
inline

Definition at line 428 of file cipherpack.hpp.

Here is the caller graph for this function:

◆ isValid()

bool cipherpack::PackHeader::isValid ( ) const
inlinenoexcept
Examples
commandline.cpp, and test_01_cipherpack.cpp.

Definition at line 429 of file cipherpack.hpp.

Here is the caller graph for this function:

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