Cipherpack v1.2.0-dirty
A Cryprographic Stream Processor
|
General User level Cipherpack API types and functionality, see Cipherpack Overview. More...
Namespaces | |
namespace | cipherpack::hash_util |
Hash utility functions to produce a hash file compatible to sha256sum as well as to produce the hash value itself for validation. | |
Classes | |
class | cipherpack::CipherpackListener |
Listener for events occurring while processing a cipherpack message via encryptThenSign() and checkSignThenDecrypt(). More... | |
class | cipherpack::Constants |
struct | cipherpack::CryptoConfig |
CryptoConfig, contains crypto algorithms settings given at encryption wired via the Cipherpack Data Stream, hence received and used at decryption if matching keys are available. More... | |
class | cipherpack::environment |
class | cipherpack::PackHeader |
Cipherpack header less encrypted keys or signatures as described in Cipherpack Data Stream. More... | |
class | cipherpack::WrappingDataSource |
This class represents an abstract data source object. More... | |
Macros | |
#define | JAVA_MAIN_PACKAGE "org/cipherpack/" |
Typedefs | |
typedef std::shared_ptr< CipherpackListener > | cipherpack::CipherpackListenerRef |
template<typename T > | |
using | cipherpack::secure_vector = std::vector< T, Botan::secure_allocator< T > > |
Functions | |
PackHeader | cipherpack::checkSignThenDecrypt (const std::vector< std::string > &sign_pub_keys, const std::string &dec_sec_key_fname, const jau::io::secure_string &passphrase, jau::io::ByteInStream &source, CipherpackListenerRef listener, const std::string_view &plaintext_hash_algo, const std::string destination_fname="") |
Verify signature then decrypt the source passing to the CipherpackListener if opt-in and also optionally store into destination file. More... | |
std::string_view | cipherpack::default_hash_algo () noexcept |
Name of default hash algo for the plaintext message, e.g. More... | |
PackHeader | cipherpack::encryptThenSign (const CryptoConfig &crypto_cfg, const std::vector< std::string > &enc_pub_keys, const std::string &sign_sec_key_fname, const jau::io::secure_string &passphrase, jau::io::ByteInStream &source, const std::string &target_path, const std::string &subject, const std::string &plaintext_version, const std::string &plaintext_version_parent, CipherpackListenerRef listener, const std::string_view &plaintext_hash_algo, const std::string destination_fname="") |
Encrypt then sign the source producing a cipherpack stream passed to the CipherpackListener if opt-in and also optionally store into destination_fname. More... | |
std::shared_ptr< Botan::Private_Key > | cipherpack::load_private_key (const std::string &privatekey_fname, const jau::io::secure_string &passphrase) |
std::shared_ptr< Botan::Public_Key > | cipherpack::load_public_key (const std::string &pubkey_fname) |
std::string | cipherpack::to_string (const PackHeader &ph) noexcept |
General User level Cipherpack API types and functionality, see Cipherpack Overview.
Cipherpack, a secure stream processor utilizing public-key signatures to authenticate the sender and public-key encryption of a symmetric-key for multiple receiver ensuring their privacy and high-performance message encryption.
Cipherpack securely streams messages through any media, via file using ByteInStream_File and via all libcurl network protocols using ByteInStream_URL are build-in and supported.
Note: libcurl must be enabled via -DUSE_LIBCURL=ON
at build.
A user may use the media agnostic ByteInStream_Feed to produce the input stream by injecting data off-thread and a CipherpackListener to receive the processed output stream.
Cipherpack is implemented using C++17 and accessible via C++ and Java.
READY TO USE
The following public-key signature and encryption, as well as symmetric-key message encryption operations are performed:
PackHeader
details.ChaCha20Poly1305
.Implementation performs all operation in-place
without redundant copies, processing the stream.
The stream's header contains the sender's public-key fingerprint and its signature for authentication by the receiving parties.
Further, the stream contains triples per receiver, its public-key fingerprint, the encrypted symmetric-key and the encrypted symmetric-nonce for each receiver, allowing a secure messaging between multiple parties:
Implementation uses an Authenticated Encryption with Additional Data (AEAD) encryption+MAC cipher algo, i.e. cipherpack::constants::aead_cipher_algo
.
The random nonce, unique for one message and used for the symmetric encryption is not a secret and doesn't have to be confidential. However, since we already encrypt the symmetric-key for each receiver, we transmit the nonce with it, encrypted.
The cipherpack stream will be produced as follows:
#define JAVA_MAIN_PACKAGE "org/cipherpack/" |
Definition at line 141 of file cipherpack.hpp.
using cipherpack::secure_vector = typedef std::vector<T, Botan::secure_allocator<T> > |
Definition at line 166 of file cipherpack.hpp.
typedef std::shared_ptr<CipherpackListener> cipherpack::CipherpackListenerRef |
Definition at line 559 of file cipherpack.hpp.
|
inlinenoexcept |
Definition at line 431 of file cipherpack.hpp.
std::shared_ptr< Botan::Public_Key > cipherpack::load_public_key | ( | const std::string & | pubkey_fname | ) |
std::shared_ptr< Botan::Private_Key > cipherpack::load_private_key | ( | const std::string & | privatekey_fname, |
const jau::io::secure_string & | passphrase | ||
) |
|
noexcept |
Name of default hash algo for the plaintext message, e.g.
for encryptThenSign() and checkSignThenDecrypt().
Value is BLAKE2b(512)
.
Note:
Definition at line 110 of file crypto0.cpp.
PackHeader cipherpack::encryptThenSign | ( | const CryptoConfig & | crypto_cfg, |
const std::vector< std::string > & | enc_pub_keys, | ||
const std::string & | sign_sec_key_fname, | ||
const jau::io::secure_string & | passphrase, | ||
jau::io::ByteInStream & | source, | ||
const std::string & | target_path, | ||
const std::string & | subject, | ||
const std::string & | plaintext_version, | ||
const std::string & | plaintext_version_parent, | ||
CipherpackListenerRef | listener, | ||
const std::string_view & | plaintext_hash_algo, | ||
const std::string | destination_fname = "" |
||
) |
Encrypt then sign the source producing a cipherpack stream passed to the CipherpackListener if opt-in and also optionally store into destination_fname.
crypto_cfg | Used CryptoConfig, consider using CryptoConfig::getDefault() |
enc_pub_keys | Public keys of the receiver, used to encrypt the symmetric-key for multiple parties. |
sign_sec_key_fname | Private key of the sender, used to sign the DER-Header-1 incl encrypted symmetric-key for authenticity. |
passphrase | Passphrase for sign_sec_key_fname , may be an empty secure_string for no passphrase. |
source | The source jau::io::ByteInStream of the plaintext message. |
target_path | Optional target path for the message, user application specific. |
subject | Optional subject of message, user application specific. |
plaintext_version | Version of this plaintext message, user semantic |
plaintext_version_parent | Version of this plaintext message's preceding message, user application specific |
listener | CipherpackListener listener used for notifications and optionally to send the ciphertext destination bytes via CipherpackListener::contentProcessed() |
plaintext_hash_algo | Optional hash algorithm for the plaintext message, produced for convenience and not wired. See default_hash_algo(). Pass an empty string to disable. |
destination_fname | Optional filename of the ciphertext destination file, not used if empty (default). If not empty and file already exists, file will be overwritten. |
Definition at line 518 of file crypto1.cpp.
PackHeader cipherpack::checkSignThenDecrypt | ( | const std::vector< std::string > & | sign_pub_keys, |
const std::string & | dec_sec_key_fname, | ||
const jau::io::secure_string & | passphrase, | ||
jau::io::ByteInStream & | source, | ||
CipherpackListenerRef | listener, | ||
const std::string_view & | plaintext_hash_algo, | ||
const std::string | destination_fname = "" |
||
) |
Verify signature then decrypt the source passing to the CipherpackListener if opt-in and also optionally store into destination file.
sign_pub_keys | Authorized sender public-keys to verify the sender's signature and hence the authenticity of the message incl. encrypted symmetric-key and ciphertext message. |
dec_sec_key_fname | Private key of the receiver, used to decrypt the symmetric-key. It shall match one of the keys used to encrypt. |
passphrase | The passphrase for dec_sec_key_fname , may be an empty secure_string for no passphrase. |
source | The source jau::io::ByteInStream of the cipherpack containing the encrypted message. |
listener | The CipherpackListener listener used for notifications and optionally to send the plaintext destination bytes via CipherpackListener::contentProcessed() |
plaintext_hash_algo | Optional hash algorithm for the plaintext message, produced for convenience and not wired. See default_hash_algo(). Pass an empty string to disable. |
destination_fname | Optional filename of the plaintext destination file, not used if empty (default). If not empty and file already exists, file will be overwritten. |
Definition at line 1134 of file crypto1.cpp.