FBB::CryptBuf(3bobcat)

Base class for DecryptBuf and EncryptBuf
(libbobcat-dev_5.02.00-x.tar.gz)

2005-2019

NAME

FBB::CryptBuf - std::streambuf derived base class for DecryptBuf and EncryptBuf

SYNOPSIS

#include <bobcat/cryptbuf>
Linking option: -lbobcat -lcrypto

DESCRIPTION

The class CryptBuf inherits from EoiBuf and may therefore be used as a base class of classes specializing std::streambuf. It is used as base class for the classes DecryptBuf and EncryptBuf, offering a protected member for accessing cipher information.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

EoiBuf (and thus from: std::streambuf)

PROTECTED CONSTRUCTOR

Analogously to std::streambuf only a protected constructor is available.

Copy and move constructors (and assignment operators) are not available.

PROTECTED MEMBER FUNCTION

All members of std:streambuf and EoiBuf are available, as FBB::CryptBuf inherits from these classes.

EXAMPLE

Here is an example from the implementation of EncryptBuf's constructor:

#include "encryptbuf.ih"

EncryptBuf::EncryptBuf(ostream &outStream, char const *type, 
                       string key, string const &iv, size_t size)
:
    CryptBuf(type, size),
    d_ctx(EVP_CIPHER_CTX_new()),
    d_encrypted(size + EVP_MAX_BLOCK_LENGTH, 0),
    d_iv(iv),
    d_key(key),
    d_outStream(outStream)
{
    prepareIV();

    if (
        not EVP_EncryptInit_ex(d_ctx, md(), 0, ucharPtr(d_key), 
                                               ucharPtr(d_iv))
    )
        throw Exception{ 1 } << "Encrypt initialization failed";

    setp();
}





FILES

bobcat/cryptbuf - defines the class interface

SEE ALSO

bobcat(7), decryptbuf(3bobcat), encryptbuf(3bobcat), eoibuf(3bobcat), eoi(3bobcat)

BUGS

None Reported.

DISTRIBUTION FILES

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).