add more spacing
[personal-kdebase.git] / runtime / kwalletd / backend / cbc.h
blob1ce971ab32c00ba7f1a3f8f51c54fbcbfa0902a7
1 /* This file is part of the KDE project
2 Copyright (C) 2001 George Staikos <staikos@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
22 #ifndef __CBC__KO__H
23 #define __CBC__KO__H
25 #include "blockcipher.h"
27 /* @internal
28 * Initialize this class with a pointer to a valid, uninitialized BlockCipher
29 * and it will apply that cipher using CBC. You may want to make the
30 * initial block a full block of random data. Do not change the block size
31 * at any time!! You must pad it yourself. Also, you can only encrypt or
32 * decrypt. You can't do both with a given instance. After you call one,
33 * calls to the other will fail in this instance.
36 class CipherBlockChain : public BlockCipher {
37 public:
38 CipherBlockChain(BlockCipher *cipher);
39 virtual ~CipherBlockChain();
41 virtual bool setKey(void *key, int bitlength);
43 virtual int keyLen() const;
45 virtual bool variableKeyLen() const;
47 virtual bool readyToGo() const;
49 virtual int encrypt(void *block, int len);
51 virtual int decrypt(void *block, int len);
53 private:
54 BlockCipher *_cipher;
55 void *_register;
56 void *_next;
57 int _len;
58 int _reader, _writer;
62 #endif