/usr/share/doc/libbobcat3/man/isymcryptstreambuf.3.html is in libbobcat-dev 3.23.01-1.
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 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 | <html><head>
<title>FBB::ISymCryptStreambuf</title>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1>FBB::ISymCryptStreambuf</h1>
<h2>libbobcat-dev_3.23.01-x.tar.gz</h2>
<h2>2005-2014</h2>
<html><head>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1></h1>
<html><head>
<title>FBB::ISymCryptStreambuf(3bobcat)</title>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1>FBB::ISymCryptStreambuf(3bobcat)</h1>
<h2>libbobcat-dev_3.23.01-x.tar.gz Symmetric Encryption Stream Buffer</h2>
<h2>2005-2014</h2>
<p>
<h2>NAME</h2>FBB::ISymCryptStreambuf - Input Filtering stream buffer doing symmetric encryption
<p>
<h2>SYNOPSIS</h2>
<strong>#include <bobcat/isymcryptstreambuf></strong><br>
Linking option: <em>-lbobcat -lcrypto</em>
<p>
<h2>DESCRIPTION</h2>
The information made available by <strong>ISymCryptStreambuf</strong> objects has
been subject to symmetric encryption or decryption. The information to be
encrypted or decrypted is made available to <strong>ISymCryptStreambuf</strong> object
via <em>std::istream</em> objects.
<p>
The <em>class ISymCryptStreambuf</em> is a class template, using a
<em>FBB::CryptType</em> template non-type parameter. Objects of the class
<em>FBB::ISymCryptStreambuf<FBB::ENCRYPT></em> encrypt the information they
receive, objects of the class <em>FBB::ISymCryptStreambuf<FBB::DECRYPT></em>
decrypt the information they receive. See also section <strong>ENUMERATION</strong> below.
<p>
All symmetric encryption methods defined by the OpenSSL library that can
be selected by name may be used in combination with <em>EncryptBuf</em> objects. To
select a particular encryption method an identifier is passed to the
constructor. E.g., <em>"aes-128-cbc"</em> indicating the AES (Rijndael) method,
using 128 bit sized keys and blocks using `cbc' mode (see below for an
explanation).
<p>
When providing shorter keys than expected by the method the provided key
is extended by adding the required number of 0-bytes. (zero valued bytes,
not <em>'0'</em> characters).
<p>
Most modes use an <em>initialization vector</em>. The initialization vector must be
provided at construction time. The matching decrypting object needs to know
the initialization vector that was used when encrypting the data: the
application must ensure that the matching decryption object receives the same
initialization vector as the one that was provided to the encryption
object. Initialization vectors are not security sensitive in the sense that
they can be sent in the clear to the decryption object. What <em>is</em>
important, though, is that they contain random data when used `for real'. When
an initialization vector is specified that is shorter than expected by the
method it will be extended with the required number of 0-bytes.
<p>
Block ciphers use one of the following four encryption modes:
<ul>
<li> <strong>CBC (Cipher Block Chaining)</strong>:<br>
The first block is XOR-ed by the initialization vector and then
encrypted using the specified method. Subsequent blocks are XOR-ed by the
encrypted version of the preceding block. Due to the initialization vector
dictionary attacks are infeasible, as long as the initialization vector is
truly random.
<li> <strong>ECB (Electronic Code Book)</strong>:<br>
Each block is encrypted by itself, using the specified encryption
method. Although an <em>initialization vector</em> may be specified, it is not
used. This method is susceptible to dictionary attacks and should therefore be
avoided, unless you know what you're doing.
<li> <strong>CFB (Cipher Feednack)</strong>:<br>
This method allows a block cipher to be used as a stream cipher. It
uses an initialization vector, which should be unique and random for each new
stream of data that is encrypted using the method. Encryption can only start
after the first data block has been received.
<li> <strong>OFB (Output Feednack)</strong>:<br>
This is an alternative way to use a block cipher as a stream
cipher. It is somewhat more susceptible to traditional data manipulation
attacks, which can usually be thwarted when a message authentication code is
added to the information as well. Like CFB it uses an initialization vector,
which should again be unique and random for each new stream of data that is
encrypted.
</ul>
<p>
The following table presents an overview of methods that are currently
available. Methods for which the block size is specified as N.A. are stream
ciphers; other methods are block ciphers:
<table>
<td colspan=5><hr></td>
<tr>
<td> method</td><td> keysize</td><td> blocksize</td><td> mode</td><td> identifier</td>
</tr>
<tr>
<td> </td><td> (bytes)</td><td> (bytes)</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> AES</td><td> 16</td><td> 8</td><td> CBC</td><td> "aes-128-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "aes-128-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "aes-128-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "aes-128-ofb"</td>
</tr>
<tr>
<td> </td><td> 24</td><td> 24</td><td> CBC</td><td> "aes-192-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "aes-192-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "aes-192-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "aes-192-ofb"</td>
</tr>
<tr>
<td> </td><td> 32</td><td> 32</td><td> CBC</td><td> "aes-256-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "aes-256-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "aes-256-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "aes-256-ofb"</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> BLOWFISH</td><td> 16</td><td> 8</td><td> CBC</td><td> "bf-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "bf-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "bf-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "bf-ofb"</td>
</tr>
<tr>
<td> max key length is 56 bytes, 16 generally used</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> CAMELLIA</td><td> 16</td><td> 16</td><td> CBC</td><td> "camellia-128-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "camellia-128-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "camellia-128-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "camellia-128-ofb"</td>
</tr>
<tr>
<td> </td><td> 24</td><td> </td><td> CBC</td><td> "camellia-192-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "camellia-192-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "camellia-192-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "camellia-192-ofb"</td>
</tr>
<tr>
<td> </td><td> 32</td><td> </td><td> CBC</td><td> "camellia-256-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "camellia-256-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "camellia-256-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "camellia-256-ofb"</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> CAST</td><td> 16</td><td> 8</td><td> CBC</td><td> "cast-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "cast-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "cast-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "cast-ofb"</td>
</tr>
<tr>
<td> min key length is 5 bytes, max is shown</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> DES</td><td> 8</td><td> 8</td><td> CBC</td><td> "des-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "des-ebc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "des-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "des-ofb"</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> DESX</td><td> 8</td><td> 8</td><td> CBC</td><td> "desx-cbc"</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> 3DES</td><td> 16</td><td> 8</td><td> CBC</td><td> "des-ede-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "des-ede"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "des-ede-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "des-ede-ofb"</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> 3DES</td><td> 24</td><td> 8</td><td> CBC</td><td> "des-ede3-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "des-ede3"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "des-ede3-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "des-ede3-ofb"</td>
</tr>
<tr>
<td> Key bytes 9-16 define the 2nd key, bytes 17-24</td>
</tr>
<tr>
<td> define the 3rd key</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> RC2</td><td> 16</td><td> 8</td><td> CBC</td><td> "rc2-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "rc2-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "rc2-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "rc2-ofb"</td>
</tr>
<tr>
<td> Key length variable, max. 128 bytes, default length is shown</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> RC2-40</td><td> 5</td><td> 8</td><td> </td><td> "rc2-40-cbc"</td>
</tr>
<tr>
<td> obsolete: avoid</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> RC2-64</td><td> 8</td><td> 8</td><td> </td><td> "rc2-64-cbc"</td>
</tr>
<tr>
<td> obsolete: avoid</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> RC4</td><td> 16</td><td> N.A.</td><td> </td><td> "rc4"</td>
</tr>
<tr>
<td> Key length is variable, max. 256 bytes. default length is shown</td>
</tr>
<tr>
<td> Encrypt again to decrypt. Don't use <em>DecryptBuf</em></td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> RC4-40</td><td> 5</td><td> N.A.</td><td> </td><td> "rc4-40"</td>
</tr>
<tr>
<td> obsolete: avoid</td>
</tr>
<td colspan=5><hr></td>
<tr>
<td> RC5</td><td> 16</td><td> 8</td><td> CBC</td><td> "rc5-cbc"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> EBC</td><td> "rc5-ecb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> CFB</td><td> "rc5-cfb"</td>
</tr>
<tr>
<td> </td><td> </td><td> </td><td> OFB</td><td> "rc5-ofb"</td>
</tr>
<tr>
<td> Key length variable, max. 256 bytes, rounds 8, 12 or 16,</td>
</tr>
<tr>
<td> default # rounds is 12</td>
</tr>
<td colspan=5><hr></td>
</table>
<p>
The RC4 stream cipher is subject to a well-known attack
(cf. <a href="http://www.wisdom.weizmann.ac.il/~itsik/RC4/Papers/Mantin1.zip">http://www.wisdom.weizmann.ac.il/~itsik/RC4/Papers/Mantin1.zip</a>)
unless the initial 256 bytes produced by the cipher are discarded.
<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>FBB::IFilterStreambuf</strong>
<p>
<h2>MEMBER FUNCTIONS</h2>
All members of <strong>FBB::IFilterStreambuf</strong> are available, as
<strong>ISymCryptStreambuf</strong> inherits from this class.
<p>
Overloaded move and/or copy assignment operators are not available.
<p>
<h2>ENUMERATION</h2>
<p>
<strong>ISymCryptStreambuf</strong> objects either encrypt or decrypt
information. <strong>ISymCryptStreambuf</strong> objects of the class
<strong>FBB::ISymCryptStreambuf<FBB::ENCRYPT></strong> encrypt the data they receive,
<strong>ISymCryptStreambuf</strong> objects of the class
<strong>FBB::ISymCryptStreambuf<FBB::DECRYPT></strong> decrypt the data they receive.
<p>
The values <em>ENCRYPT</em> and <em>DECRYPT</em> are defined in the <em>enum CryptType</em>,
which is defined in the <em>FBB</em> namespace.
<p>
<h2>CONSTRUCTOR</h2>
<ul>
<li> <strong>ISymCryptStreambuf<CryptType>(
std::istream &in, char const *type,
std::string const &key, std::string const &iv,
size_t bufSize = 100, size_t filterBufSize = 1000,
ENGINE *engine = 0)</strong>:<br>
This constructor initializes the streambuf.
<ul>
- <em>ISymCryptStreambuf<ENCRYPT></em> objects perform encryption;<br>
<em>ISymCryptStreambuf<DECRYPT></em> objects perform decryption;<br>
- <em>ISymCryptStreambuf<CryptType></em> objects obtain the bytes to encrypt
or decrypt from <em>std::istream &in</em>;<br>
- The encryption method to use is specified by the <em>type</em>
parameter. E.g., <em>"bf-cbc"</em> selects the Blowfish Cipher Block Chaining
method;<br>
- The symmetric key to use is specified by the <em>key</em> parameter;<br>
- The initialization vector is specified by the <em>iv</em> parameter;<br>
- The <em>FBB::ISymCryptStreambuf</em> internally used buffer will contain
<em>bufSize</em> characters. The default value is the smallest value that is
used. When a smaller <em>bufSize</em> value is specified, the default value is
used;<br>
- <em>FBB::ISymCryptStreambuf</em>'s <em>IFilterStreambuf</em> base class is
initialized with a buffer of size <em>filterBufSize</em>, using a lower bound
of 100;<br>
- The parameter <em>ENGINE</em> can be used to specify a hardware
accelleration engine, as supported by the used encryption/decryption
method. Its default argument value indicates that no hardware accelleration is
available.
</ul>
</ul>
Copy- and move constructors are not available.
<p>
<h2>EXAMPLE</h2>
<p>
The example shows the construction of an <em>ISymCryptStreambuf<ENCRYPT></em>
object <em>ebuf</em> which is used to initialize a <em>std::istream</em> object. The
information read from this <em>istream</em> is encrypted using the Blowfish CBC
method. A <em>ISymCryptStreambuf<DECRYPT></em> object (<em>dbuf</em> reads the
information from that stream and decrypts it again). The <em>std::istream din</em>
object is initialized with the <em>ISymCryptStreambuf<DECRYPT></em> object, and its
contents is sent to <em>std::cout</em>. The information that is presented at
<em>std::cin</em> and that appears at <em>std::cout</em> should be identical.
<p>
<pre>
#include <iostream>
#include <bobcat/isymcryptstreambuf>
using namespace std;
using namespace FBB;
int main()
{
ISymCryptStreambuf<ENCRYPT> ebuf(cin, "bf-cbc",
"1234567890", "1234567890");
istream ein(&ebuf);
ISymCryptStreambuf<DECRYPT> dbuf(ein, "bf-cbc",
"1234567890", "1234567890");
istream din(&dbuf);
cout << din.rdbuf();
}
</pre>
<p>
<h2>FILES</h2>
<em>bobcat/isymcryptstreambuf</em> - defines the class interface
<p>
<h2>SEE ALSO</h2>
<strong>bobcat</strong>(7), <strong>encryptbuf</strong>(3bobcat), <strong>isymcryptstream</strong>(3bobcat),
<strong>ibase64streambuf</strong>(3bobcat), <strong>ifilterstreambuf</strong>(3bobcat),
<strong>ofilterstreambuf</strong>(3bobcat), <strong>std::streambuf</strong>.
<p>
<h2>BUGS</h2>
<p>
Sep/Oct 2013: due to a change in library handling by the linker
(cf. <a href="http://fedoraproject.org/wiki/UnderstandingDSOLinkChange">http://fedoraproject.org/wiki/UnderstandingDSOLinkChange</a> and
<a href="https://wiki.debian.org/ToolChain/DSOLinking">https://wiki.debian.org/ToolChain/DSOLinking</a>) libraries that are
indirectly required are no longer automatically linked to your program. With
<strong>BigInt</strong> this is <em>libcrypto</em>, which requires programs to link to both
<em>bobcat</em> and <em>crypto</em>.
<p>
<h2>DISTRIBUTION FILES</h2>
<ul>
<li> <em>bobcat_3.23.01-x.dsc</em>: detached signature;
<li> <em>bobcat_3.23.01-x.tar.gz</em>: source archive;
<li> <em>bobcat_3.23.01-x_i386.changes</em>: change log;
<li> <em>libbobcat1_3.23.01-x_*.deb</em>: debian package holding the
libraries;
<li> <em>libbobcat1-dev_3.23.01-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>
|