.TH "FBB::CryptBuf" "3bobcat" "2005\-2020" "libbobcat\-dev_5\&.07\&.00" "Base class for DecryptBuf and EncryptBuf" .PP .SH "NAME" FBB::CryptBuf \- std::streambuf derived base class for DecryptBuf and EncryptBuf .PP .SH "SYNOPSIS" \fB#include \fP .br Linking option: \fI\-lbobcat \-lcrypto\fP .PP .SH "DESCRIPTION" The class \fICryptBuf\fP inherits from \fIEoiBuf\fP and may therefore be used as a base class of classes specializing \fIstd::streambuf\fP\&. It is used as base class for the classes \fIDecryptBuf\fP and \fIEncryptBuf\fP, offering a protected member for accessing cipher information\&. .PP .SH "NAMESPACE" \fBFBB\fP .br All constructors, members, operators and manipulators, mentioned in this man\-page, are defined in the namespace \fBFBB\fP\&. .PP .SH "INHERITS FROM" \fIEoiBuf\fP (and thus from: \fIstd::streambuf\fP) .PP .SH "PROTECTED CONSTRUCTOR" .PP Analogously to \fIstd::streambuf\fP only a protected constructor is available\&. .PP .IP o \fBCryptBuf(char const *type, size_t bufSize)\fP: .br The type is a null\-terminated byte string specifying the de/encryption method\&. E\&.g\&., \fIaes\-128\-cbc\fP\&. For an overview see the \fBencryptbuf\fP(3bobcat) man\-page\&. The \fIbufSize\fP parameter defines the initial size of the internally used buffer (defined by \fIEoiBuf\fP)\&. .PP Copy and move constructors (and assignment operators) are not available\&. .PP .SH "PROTECTED MEMBER FUNCTION" .PP All members of \fIstd:streambuf\fP and \fIEoiBuf\fP are available, as \fBFBB::CryptBuf\fP inherits from these classes\&. .PP .IP o \fBEVP_CIPHER const *md() const\fP: .br A pointer to the cipher information is returned\&. .PP .SH "EXAMPLE" Here is an example from the implementation of \fIEncryptBuf\(cq\&s\fP constructor: .PP .nf #include \(dq\&encryptbuf\&.ih\(dq\& 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 } << \(dq\&Encrypt initialization failed\(dq\&; setp(); } .fi .PP .SH "FILES" \fIbobcat/cryptbuf\fP \- defines the class interface .PP .SH "SEE ALSO" \fBbobcat\fP(7), \fBdecryptbuf\fP(3bobcat), \fBencryptbuf\fP(3bobcat), \fBeoibuf\fP(3bobcat), \fBeoi\fP(3bobcat) .PP .SH "BUGS" None Reported\&. .PP .SH "BOBCAT PROJECT FILES" .PP .IP o \fIhttps://fbb\-git\&.gitlab\&.io/bobcat/\fP: gitlab project page; .IP o \fIbobcat_5\&.07\&.00\-x\&.dsc\fP: detached signature; .IP o \fIbobcat_5\&.07\&.00\-x\&.tar\&.gz\fP: source archive; .IP o \fIbobcat_5\&.07\&.00\-x_i386\&.changes\fP: change log; .IP o \fIlibbobcat1_5\&.07\&.00\-x_*\&.deb\fP: debian package containing the libraries; .IP o \fIlibbobcat1\-dev_5\&.07\&.00\-x_*\&.deb\fP: debian package containing the libraries, headers and manual pages; .PP .SH "BOBCAT" Bobcat is an acronym of `Brokken\(cq\&s Own Base Classes And Templates\(cq\&\&. .PP .SH "COPYRIGHT" This is free software, distributed under the terms of the GNU General Public License (GPL)\&. .PP .SH "AUTHOR" Frank B\&. Brokken (\fBf\&.b\&.brokken@rug\&.nl\fP)\&. .PP