FBB::DecryptBuf

FBB::DecryptBuf

libbobcat1-dev_2.08.01-x.tar.gz

2005-2010


FBB::DecryptBuf(3bobcat)

FBB::DecryptBuf(3bobcat)

libbobcat1-dev_2.08.01-x.tar.gz Decrypt information

2005-2010

NAME

FBB::DecryptBuf - Decrypts information using various methods into a std::ostream

SYNOPSIS

#include <bobcat/decryptbuf>
Linking option: -lbobcat -lssl

DESCRIPTION

FBB::DecryptBuf objects are std::streambuf objects that can be used to initialize std::ostream objects with.

All information inserted into such a std::ostream is decrypted and written into a std::ostream that is given as argument to DecryptBuf's constructor.

All encryption methods defined by the OpenSSL library that can be selected by name may be used in combination with DecryptBuf objects. Most likely the information will have been encrypted using an EncryptBuf object, selecting a particular encryption method. The encryption method used when encrypting information should also be specified when constructing a DecryptBuf object. Likewise, the constructor expects a key and initialization vector. The key and initialization vector that was passed to the EncryptBuf object must be passed to DecryptBuf's constructor as well.

Information about the various encryption methods and cipher modes as well as information about how keys and initialization vectors are handled is found in the EncryptBuf(3bobcat) manual page and need not be repeated here.

NAMESPACE

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

INHERITS FROM

std::streambuf

CONSTRUCTOR/DESTRUCTOR

There is no copy constructor, nor move constructor (as std::streambuf doesn't support either).

MEMBER FUNCTIONS

All members of std::streambuf are available, as FBB::DecryptBuf inherits from this class. Some of the std::streambuf's member are overridden or are hidden by DecryptBuf. In normal situations these inherited members will not be used by programs using DecryptBuf objects.

STATIC MEMBER

PROTECTED MEMBER

EXAMPLE

#include <iostream>
#include <fstream>
#include <bobcat/errno>
#include <bobcat/decryptbuf>

using namespace std;
using namespace FBB;

int main(int argc, char **argv)
try
{
    if (argc == 1)
        throw Errno("1st arg: method, 2nd arg: key, 3rd arg: file to "
                    "decrypt (to stdout), 4th arg: iv");

    cerr << "Key: `" << argv[2] << "'\n"
            "IV:  `" << argv[4] << "'\n";

    DecryptBuf decryptbuf(cout, argv[1], argv[2], argv[4]);
    ostream out(&decryptbuf);
    ifstream in(argv[3]);

    out << in.rdbuf();
    // decryptbuf.done();       // optionally
}
catch(Errno const &err)
{
    cout << err.what() << endl;
    return 1;
}





FILES

bobcat/decryptbuf - defines the class interface

SEE ALSO

bobcat(7), encryptbuf(3bobcat), std::streambuf

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).