/usr/share/doc/libbobcat4-dev/man/hmacbuf.3.html is in libbobcat-dev 4.08.02-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | <!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::HMacBuf(3bobcat)</title>
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
.XXfc {margin-left:auto;margin-right:auto;}
.XXtc {text-align: center;}
.XXtl {text-align: left;}
.XXtr {text-align: right;}
.XXvt {vertical-align: top;}
.XXvb {vertical-align: bottom;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr/>
<h1 id="title">FBB::HMacBuf(3bobcat)</h1>
<h2 id="author">Compute HMAC Message Digests<br/>(libbobcat-dev_4.08.02-x.tar.gz)</h2>
<h2 id="date">2005-2017</h2>
<p>
<h2 >NAME</h2>FBB::HMacBuf - Computes HMAC Message Digests from information inserted into a
std::ostream
<p>
<h2 >SYNOPSIS</h2>
<strong >#include <bobcat/hmacbuf></strong><br/>
Linking option: <em > -lbobcat -lcrypto</em>
<p>
<h2 >DESCRIPTION</h2>
<strong >FBB::HMacBuf</strong> objects are <strong >std::streambuf</strong> objects that can be used
to initialize <em >std::ostream</em> objects with.
<p>
All information inserted into such a <em >std::ostream</em> is used to compute a
message HMAC from.
<p>
All the message digest algorithms defined by the OpenSSL library that can
be selected by name may be used in combination with <em >HMacBuf</em> objects.
<p>
The following message hmac algorithms are currently supported: mull, md2,
md5, sha, sha1, sha224, sha256, sha384, sha512, dss, dss1, ecdsa, mdc2,
ripemd160. These very names are the ones to use to select the particular
digest algorithm for the class's constructor, below. It is quite possible that
future releases of the openssl library will support additional message digest
algorithms. The header file <em >openssl/evp.h</em> lists all available hmac
algorithms (in that file look for <em >EVP_MD *EVP_</em>: a message digest algorithm
immediately follows the 2nd underscore. E.g., <em >const EVP_MD *EVP_md4(void)</em>
which refers to the md4 message digest algorithm).
<p>
<h2 >NAMESPACE</h2>
<strong >FBB</strong><br/>
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace <strong >FBB</strong>.
<p>
<h2 >INHERITS FROM</h2>
<strong >std::streambuf</strong>
<p>
<h2 >CONSTRUCTORS</h2>
<ul>
<li> <strong >HMacBuf(std::string const &key, char const *type,
size_t bufsize = 1024)</strong>:<br/>
This constructor initializes the streambuf, setting it up for the
message digest algorithm specified with <em >type</em>. The message hmac
algorithms specified in the <strong >DESCRIPTION</strong> section may be used here. E.g., to
use the sha256 algorithm specify <em >"sha256"</em>.
<p>
The constructor's first argument defines the key to be used when computing
the HMAC message digest.
<p>
The <em >bufsize</em> argument specifies the internal buffer used by
<em >HMacBuf</em> to store incoming characters temporarily. The provided default
argument should be OK in all normal cases.
</ul>
There is no copy constructor.
<p>
<h2 >OVERLOADED OPERATOR</h2>
<p>
<ul>
<li> <strong >std::ostream &operator<<(std::ostream &out,
HMacBuf const &hmacbuf)</strong>:<br/>
The insertion operator is a free function defined in the namespace
<em >FBB</em>. It inserts a hash value as a series of hexadecimally displayed values
into the provided <em >ostream</em>. See the example below for an illustration.
</ul>
The overloaded assignment operator is not available.
<p>
<h2 >MEMBER FUNCTIONS</h2>
<p>
All members of <strong >std::streambuf</strong> are available, as <strong >FBB::HMacBuf</strong>
inherits from this class. Some of the <strong >std::streambuf</strong>'s member are
overridden or are hidden by <em >HMacBuf</em>. In normal situations these
inherited members will not be used by programs using <em >HMacBuf</em> objects.
<p>
<ul>
<li> <strong >void close()</strong>:<br/>
This member finishes the computation of the message digest
computation. It is needed as the <em >HMacBuf</em> object has no external means
for deciding whether all information to compute the digest for has yet been
received or not. The general approach to follow when computing a message
hmac is therefore:
<pre>
create a HMacBuf object
use it to create a std::ostream object
insert information into the ostream object
call the HMacBuf object's close() member
obtain/process the hash value from the HMacBuf object.
</pre>
<li> <strong >std::string const &hash() const</strong>:<br/>
This member returns the hash value computed by the <em >HMacBuf</em>
object. Its value is only defined after having called <em >close()</em>. The hash
value is returned in a <em >std::string</em> object. This string's <em >length()</em>
member contains the number of characters used by the hash value, and its
<em >data()</em> member refers to the hash value's characters. Note that a hash
value's character value may be 0 (not to be confused with <em >'0'</em>).
<li> <strong >void open()</strong>:<br/>
This member reinitializes the message hmac computation. One a
message hmac has been computed for, say a stream <em >streamA</em> this member can
be called after which the hmac for a stream <em >streamB</em> can be computed
using the same <em >HMacBuf</em> object.
</ul>
<p>
<h2 >EXAMPLE</h2>
<pre >
#include <iostream>
#include <ostream>
#include <cstring>
#include <iomanip>
#include <bobcat/exception>
#include <bobcat/hmacbuf>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
try
{
if (argc < 3)
throw Exception(0) << "Arg1: key, arg2: digest method required";
string key(argv[1]);
HMacBuf hmacbuf(key, argv[2]);
ostream out(&hmacbuf);
string hw("hello world\n");
out << hw;
hmacbuf.close();
cout << ">" << hmacbuf << "<" << endl;
hmacbuf.open();
out.write(hw.c_str(), hw.length());
hmacbuf.close();
cout << ">" << hmacbuf << "<" << endl;
}
catch(exception const &err)
{
cout << err.what() << endl;
return errno;
}
</pre>
<p>
<h2 >FILES</h2>
<em >bobcat/hmacbuf</em> - defines the class interface
<p>
<h2 >SEE ALSO</h2>
<strong >bobcat</strong>(7), <strong >digestbuf</strong>(3bobcat), <strong >std::streambuf</strong>
<p>
<h2 >BUGS</h2>
None reported
<p>
<h2 >DISTRIBUTION FILES</h2>
<ul>
<li> <em >bobcat_4.08.02-x.dsc</em>: detached signature;
<li> <em >bobcat_4.08.02-x.tar.gz</em>: source archive;
<li> <em >bobcat_4.08.02-x_i386.changes</em>: change log;
<li> <em >libbobcat1_4.08.02-x_*.deb</em>: debian package holding the
libraries;
<li> <em >libbobcat1-dev_4.08.02-x_*.deb</em>: debian package holding the
libraries, headers and manual pages;
<li> <em >http://sourceforge.net/projects/bobcat</em>: public archive location;
</ul>
<p>
<h2 >BOBCAT</h2>
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.
<p>
<h2 >COPYRIGHT</h2>
This is free software, distributed under the terms of the
GNU General Public License (GPL).
<p>
<h2 >AUTHOR</h2>
Frank B. Brokken (<strong >f.b.brokken@rug.nl</strong>).
<p>
</body>
</html>
|