WvStreams
wvcountermode.h
1/* -*- Mode: C++ -*-
2 * Worldvisions Tunnel Vision Software:
3 * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4 *
5 * A 'counter mode' cryptography engine abstraction.
6 */
7#ifndef __WVCOUNTERMODE_H
8#define __WVCOUNTERMODE_H
9
10#include "wvencoder.h"
11
14{
15public:
16 WvEncoder *keycrypt;
17
26 const void *_counter, size_t _countersize);
27 virtual ~WvCounterModeEncoder();
28
34 void setcounter(const void *counter, size_t countersize);
35
40 void getcounter(void *counter) const;
41
43 size_t getcountersize() const
44 { return countersize; }
45
47 virtual void incrcounter();
48
49private:
50 WvConstInPlaceBuf counterbuf;
51
52protected:
53 unsigned char *counter; // auto-incrementing counter
54 size_t countersize; // counter size in bytes
55
56 virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush);
57};
58
59#endif // __WVCOUNTERMODE_H
The const in place raw memory buffer type.
Definition wvbuf.h:188
A counter mode encryption encoder.
virtual void incrcounter()
Increments the counter.
void getcounter(void *counter) const
Stores the current counter in the supplied buffer.
size_t getcountersize() const
Returns the counter size.
void setcounter(const void *counter, size_t countersize)
Sets the Counter mode auto-incrementing counter.
virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush)
Template method implementation of encode().
The base encoder class.
Definition wvencoder.h:68
bool flush(WvBuf &inbuf, WvBuf &outbuf, bool finish=false)
Flushes the encoder and optionally finishes it.
Definition wvencoder.h:163