This file is indexed.

/usr/share/doc/libbobcat4-dev/man/encryptbuf.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
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
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
<!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::EncryptBuf(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::EncryptBuf(3bobcat)</h1>
<h2 id="author">Encrypt information<br/>(libbobcat-dev_4.08.02-x.tar.gz)</h2>
<h2 id="date">2005-2017</h2>


<p>
<h2 >NAME</h2>FBB::EncryptBuf - Encrypts information using various methods into a std::ostream 
<p>
<h2 >SYNOPSIS</h2>
    <strong >#include &lt;bobcat/encryptbuf&gt;</strong><br/>
    Linking option: <em > -lbobcat -lcrypto</em> 
<p>
<h2 >DESCRIPTION</h2>
    <strong >FBB::EncryptBuf</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 encrypted and
written into a <em >std::ostream</em> that is given as argument to <em >EncryptBuf</em>'s
constructor.
<p>
All 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>. Unless provided at construction
time or explicitly set thereafter an initialization vector containing randomly
selected values will be used. The initialization vector that is actually used
can be obtained from the <em >EncryptBuf</em> object. This is important, as the
matching decrypting object needs to know the initialization vector that was
used when encrypting the data. 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>

    <tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

    
<tr >
<td > DESX</td><td > 8</td><td > 8</td><td > CBC</td><td > "desx-cbc"</td>
 
</tr>

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

    
<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>
 
<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

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

<tr><td colspan=5><hr/></td></tr>

    
</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 >std::streambuf</strong>
<p>
<h2 >CONSTRUCTOR</h2>
    <ul>
    <li> <strong >EncryptBuf(std::ostream &amp;outStream, char const *type, 
                            std::string const &amp;key, std::string const &amp;iv,
                            size_t bufsize = 1024)</strong>:<br/>
        This constructor initializes the <em >EncryptBuf</em> object preparing it
for the message encrypt algorithm specified with <em >type</em>. The encryption
algorithms that can be used are listed in the table found in the
<strong >DESCRIPTION</strong> section. E.g., to use the AES method on 24 bit keys and
blocks in CBC mode specify <em >"aes-192-cbc"</em>. The <em >key</em> parameter refers to
the key to be used, the <em >iv</em> parameter refers to the initialization vector
to use. Both <em >key</em> and <em >iv</em> may contain non-displayable characters. When
<em >iv.length()</em> is zero at the time encryption starts it will be filled by the
<em >EncryptBuf</em> object with random data. When the key and/or the iv is too
small for the requested method they will be expanded by adding the required
number of zero valued bytes.
<p>
The constructor throws an <em >FBB::Exception</em> exception if an unknown
encryption method was specified.
<p>
The constructor's first parameter refers to the <em >std::ostream</em> to
receive the encrypted information. Be aware of the fact that the encrypted
information most likely contains non-displayable characters.
<p>
The <em >bufsize</em> argument specifies the size in bytes of the internal
buffer used by <em >EncryptBuf</em> to store incoming characters temporarily. The
provided default argument should be OK in all normal cases.
    </ul>
    There is no copy constructor, nor move constructor (as <em >std::streambuf</em>
doesn't support either).
<p>
<h2 >MEMBER FUNCTIONS</h2>
<p>
All members of <strong >std::streambuf</strong> are available, as <strong >FBB::EncryptBuf</strong>
inherits from this class. Some of the <strong >std::streambuf</strong>'s member are
overridden or are hidden by <em >EncryptBuf</em>. In normal situations these
inherited members will not be used by programs using <em >EncryptBuf</em> objects.
<p>
<ul>
    <li> <strong >size_t blockLength() const</strong>:<br/>
        This member returns the block size (in bytes) that are used by
the specified method.
    <li> <strong >size_t ivLength() const</strong>:<br/>
        This member returns the size (in bytes) of the initialization vector
that is used by the specified method.
    <li> <strong >std::string iv() const</strong>:<br/>
        This member returns a reference to the initialization vector
that is used by the specified method. Be advised that the initialization
vector may contain non-displayable characters. 
    <li> <strong >size_t keyLength() const</strong>:<br/>
        This member returns the size of the key (in bytes) that are used by
the specified method.
    <li> <strong >size_t rounds() const</strong>:<br/>
        This member can only be used with the RC5 encryption method to query
the number of rounds of the algorithm. It returns the currently used number of
rounds or 0 if the member is called for another encryption method than RC5.
    <li> <strong >void setIv(std::string const &amp;iv)</strong>:<br/>
        This member can be used to specify the initialization vector to use
after construction time but before any data has been encrypted. When called
after encryption has started an <em >FBB::Exception</em> exception will be thrown.
    <li> <strong >void setKey(std::string const &amp;key, size_t numberOfBytes = 0)</strong>:<br/>
        This member can be used to specify the key and its length after
construction time but before any data has been encrypted. When called after
encryption has started an <em >FBB::Exception</em> exception will be thrown. The size of
the key is assumed to be the number of bytes in the key's data. If another key
length is required the member function's second parameter can be used to
specify the length of the key <em >in bytes</em>.
    <li> <strong >bool setRounds(size_t nRounds)</strong>:<br/>
        This member can only be used with the RC5 encryption method to set the
number of rounds of the algorithm to 8, 12 or 16. When the number of rounds
were updated successfully the member returns <em >true</em>. It returns <em >false</em> in
other cases (e.g., called for other encryption methods than RC5 or the
requested number of rounds differ from 8, 12 or 16).
    </ul>
<p>
<h2 >PROTECTED MEMBER</h2>
    <ul>
    <li> <strong >EVP_CIPHER_CTX *cipherCtx()</strong>:<br/>
        Classes derived from <em >EncryptBuf</em> may use this member to gain direct
access to the <em >EVP_CIPHER_CTX</em> pointer used by the <em >EncryptBuf</em>
object. This pointer is a pointer to an opaque structure used by many OpenSSL
functions to set or query parameters of an encryption method.
    </ul>
<h2 >EXAMPLE</h2>
    <pre >
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;bobcat/exception&gt;
#include &lt;bobcat/encryptbuf&gt;
#include &lt;bobcat/ohexstreambuf&gt;

#include &lt;openssl/evp.h&gt;

using namespace std;
using namespace FBB;

int main(int argc, char **argv)
try
{
    if (argc == 1)
        throw Exception(1) &lt;&lt; 
                    "1st arg: method, 2nd arg: key, 3rd arg:  (opt): iv, "
                    "stdin: file to encrypt (to stdout)";

    string key(argv[2]);
    string iv;

    if (argc &gt; 3)
        iv = argv[3];

    EncryptBuf encryptbuf(cout, argv[1], key, iv);
    ostream out(&amp;encryptbuf);
    cerr &lt;&lt; "Block length: " &lt;&lt; encryptbuf.blockLength() &lt;&lt; '\n' &lt;&lt;
            "Key length: " &lt;&lt; encryptbuf.keyLength() &lt;&lt; '\n' &lt;&lt;
            "Max Key length: " &lt;&lt; EVP_MAX_KEY_LENGTH &lt;&lt; '\n' &lt;&lt;
            "IV length: " &lt;&lt; encryptbuf.ivLength() &lt;&lt; endl;
            
    cerr &lt;&lt; encryptbuf.iv().length() &lt;&lt; ' ';

    OHexStreambuf ohsb(cerr);

    ostream ohs(&amp;ohsb);
    ohs.write(encryptbuf.iv().data(), encryptbuf.iv().length()) &lt;&lt; flush;
    cerr &lt;&lt; endl;

    out &lt;&lt; cin.rdbuf();
}
catch(exception const &amp;err)
{
    cout &lt;&lt; err.what() &lt;&lt; endl;
    return 1;
}
</pre>

<p>
To ignore the initial 256 bytes generated by the RC4 algorithm a simple
wrapper class around the eventual output stream can be used. Here is an
illustration:
        <pre>

    #include &lt;ostream&gt;
    #include &lt;bobcat/ofilterstreambuf&gt;
    
    class Skip256: public FBB::OFilterStreambuf
    {
        size_t d_count;
        public:
            Skip256(std::ostream &amp;os)
            :
                OFilterStreambuf(os),
                d_count(0)
            {}
        private:
            virtual int overflow(int c)
            {
                if (d_count == 256)
                    out().put(c);
                else
                    ++d_count;
                return c;
            }
    };
        
</pre>

    Next, an <em >Skip256</em> object is used to define an intermediate
<em >std::ostream</em> that is then passed to the <em >EncryptBuf</em> object. E.g., only
showing the essential steps defining the <em >EncryptBuf</em> object:
        <pre>

    Skip256 skip256(std::cout);
    std::ostream out(&amp;skip256);

    EncryptBuf encryptbuf(out, "rc4", key, "");
        
</pre>

<p>
<h2 >FILES</h2>
    <em >bobcat/encryptbuf</em> - defines the class interface
<p>
<h2 >SEE ALSO</h2>
    <strong >bobcat</strong>(7), <strong >decryptbuf</strong>(3bobcat), <strong >ofilterstreambuf</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>