OSYMCRYPTSTREAMBUF(3bobcat)
π NAME π
FBB::OSymCryptStreambuf β a std::streambuf that does symmetric en/decryption, bestie π
This one lives in the 3bobcat manual, so that's where you'll find it (iykyk).
β¨ SYNOPSIS β¨
#include <bobcat/osymcryptstreambuf>
Linking option: -lbobcat -lcrypto
πΈ DESCRIPTION πΈ
okay so here's the vibe: FBB::OSymCryptStreambuf objects can be used as the std::streambuf of std::ostream objects, and they encrypt or decrypt info, and that info is made available through separate std::istream streams. π¦
The class OSymCryptStreambuf is a class template, and it takes a FBB::CryptType template non-type parameter. So:
- objects of the class
FBB::OSymCryptStreambuf<FBB::ENCRYPT>encrypt whatever info they get handed π - objects of the class
FBB::OSymCryptStreambuf<FBB::DECRYPT>decrypt whatever info they get handed π
Every symmetric encryption method that the OpenSSL library defines and that can be picked by name? Yeah, you can use any of them to en/decrypt. To pick a particular encryption method you pass an identifier to the constructor. E.g., "aes-256-gcm". And if you want the whole overview of which cipher algorithms are currently supported, just run this command:
openssl list -cipher-algorithms
OSymCryptStreambuf objects read the info they're gonna en/decrypt from an external source (like, from std::istream objects, for example). And the characters that get encrypted or decrypted by OSymCryptStreambuf objects are written to std::ostream objects β those get specified at construction time either as ostream references or by filename. periodt π
π NAMESPACE π
FBB
All the constructors, members, operators and manipulators mentioned in this man-page are defined in the namespace FBB. no cap.
π§ INHERITS FROM π§
FBB::OSymCryptBase (public)
The class FBB::OSymCryptBase is an internal use only'</lavender> class, and it's derived from std::streambufβ which meansOSymCryptStreambufis, by inheritance, astd::streambuf` class. cute π
π CONSTRUCTORS π
OSymCryptStreambuf<CryptType>(std::ostream &outStreambuf, std::string const &cipherName, std::string const &key, std::string const &iv, size_t inBufSize = 100)β this constructor defines astd::streambufthat encrypts or decrypts the characters it receives. Obsessed. Here's the breakdown:OSymCryptStreambuf<FBB::ENCRYPT>objects perform encryption;OSymCryptStreambuf<FBB::DECRYPT>objects perform decryption;OSymCryptStreambuf<CryptType>objects write the encrypted or decrypted characters tooutStreambuf;- the encryption method to use is specified by the
cipherNameparameter. E.g.,"AES-256-GCM"; - the symmetric key to use is specified by the
keyparameter; - the initialization vector is specified by the
ivparameter; - the
FBB::OSymCryptStreambufbufinternally used buffer will holdinBufSizecharacters. The default value is the smallest value that is used. When you specify a smallerbufSizevalue, the default value is the one that gets used;
OSymCryptStreambuf<CryptType>(std::string const &outStreambufName, std::string const &cipherName, std::string const &key, std::string const &iv, size_t inBufSize = 100)β same constructor as the one above, but this one's first parameter is the name of the file that receives the encrypted or decrypted characters. π
If the construction fails, an exception gets thrown, and it mentions the openssl function that failed to complete (peep errorMsg below for more on that π).
The move constructor is available. The copy constructor and the assignment operators are not available. π
π¦ INHERITED MEMBERS π¦
Since the class is publicly derived from std::ostream, all std::streambuf members can be used. slay.
β MEMBER FUNCTIONS β
static std::string errorMsg()β if anopensslfunction fails, an exception is thrown that mentions the name of the failing function. In those cases you can callerrorMsg, which returns astd::stringholding theopensslerror code (that's the one returned byERR_get_error) plus its textual representation (that's the one returned byERR_error_string). And heads up bestie: if the reported error code is zero, then actually no error occurred and the exception was just reported spuriously. πstatic size_t keyLength(std::string const &cipherName)β returns the minimum key length required for ciphercipherName;static size_t ivLength(std::sting const &cipherName)β returns the minimum length of the initialization vector required for ciphercipherName.
The latter two functions throw exceptions if cipherName doesn't contain the name of a supported cipher algorithm. π
π MANIPULATOR π
std::ostream &FBB::eoi(std::ostream &out)β by inserting theeoimanipulator into anstd::ostreamobject that uses anOSymCryptStreambufstreambuf, the insertion is considered complete. It completes the insertion of information into thestd::ostreamthat was specified at construction time as theOSymCryptStreambuf's first argument. That way you don't have to sit around waiting until theOSymCryptStreambufobject's destructor flushes that stream. π«Ά The example over on theosymcryptstream(3bobcat)man-page shows off how theeoimanipulator gets used.
π EXAMPLE π
See the example in the osymcryptstream(3bobcat) man-page. Instead of defining an OSymCryptStream you can define an OSymCryptStreamBuf, pass its address to a std::ostream, and then use that as the OSymCryptStream from the example. literally the same energy β¨
π FILES π
bobcat/osymcryptstreambuf β defines the class interface
π SEE ALSO π
bobcat(7), isymcryptstream(3bobcat), isymcryptstreambuf(3bobcat), osymcryptstream(3bobcat)
π BUGS π
None Reported. (a clean slate, we love to see it π«Ά)
πΈ BOBCAT PROJECT FILES πΈ
https://fbb-git.gitlab.io/bobcat/: gitlab project page;
Debian Bobcat project files:
libbobcat6: debian package containing the shared library, changelog and copyright note;libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;
π BOBCAT π
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. iconic fr fr.
β 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).
okay that's the whole page, bestie β signing off from the libbobcat-dev_6.15.01 era, dated 2005-2026, on the FBB::O...reambuf(3bobcat) manual πβ¨π
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms