KWallet

cbc.h
1/*
2 This file is part of the KDE project
3 SPDX-FileCopyrightText: 2001 George Staikos <staikos@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.0-or-later
6*/
7
8#ifndef __CBC__KO__H
9#define __CBC__KO__H
10
11#include "blockcipher.h"
12
13/* @internal
14 * Initialize this class with a pointer to a valid, uninitialized BlockCipher
15 * and it will apply that cipher using CBC. You may want to make the
16 * initial block a full block of random data. Do not change the block size
17 * at any time!! You must pad it yourself. Also, you can only encrypt or
18 * decrypt. You can't do both with a given instance. After you call one,
19 * calls to the other will fail in this instance.
20 */
21
22class CipherBlockChain : public BlockCipher
23{
24public:
25 CipherBlockChain(BlockCipher *cipher, bool useECBforReading = false);
26 ~CipherBlockChain() override;
27
28 bool setKey(void *key, int bitlength) override;
29
30 int keyLen() const override;
31
32 bool variableKeyLen() const override;
33
34 bool readyToGo() const override;
35
36 int encrypt(void *block, int len) override;
37
38 int decrypt(void *block, int len) override;
39
40private:
41 void initRegister();
42 int decryptECB(void *block, int len);
43
44 BlockCipher *_cipher;
45 void *_register;
46 void *_next;
47 int _len;
48 int _reader, _writer;
49 bool _useECBforReading;
50};
51
52#endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 10 2024 11:47:59 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.