/usr/include/bobcat/encryptbuf is in libbobcat-dev 4.04.00-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 | #ifndef INCLUDED_BOBCAT_ENCRYPTBUF_
#define INCLUDED_BOBCAT_ENCRYPTBUF_
// https://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption
#include <iosfwd>
#include <streambuf>
#include <openssl/ossl_typ.h>
namespace FBB
{
struct EncryptBufImp;
class EncryptBuf: public std::streambuf
{
EncryptBufImp *d_pimpl;
public:
EncryptBuf(std::ostream &outStream, char const *type,
std::string key, std::string iv,
size_t bufsize = 1024);
virtual ~EncryptBuf();
void setKey(std::string key, size_t numberOfBytes = 0);
void setIv(std::string iv);
size_t keyLength() const; // bytes
size_t blockLength() const; // bytes
size_t ivLength() const; // bytes
bool setRounds(size_t nRounds); // RC5 8, 12 or 16
size_t rounds() const; // RC5
std::string const &iv() const;
protected:
EVP_CIPHER_CTX *cipherCtx();
private:
void update();
void open();
void installKey(std::string const &key, size_t length);
virtual int overflow(int c);
};
} // FBB
/*
EVP_enc_null()
Null cipher: does nothing.
DES:
Avoid, unless required, uses 8 byte buffer and 8 byte key
EVP_des_cbc(),
EVP_des_ecb(),
EVP_des_cfb(),
EVP_des_ofb()
DES in CBC, ECB, CFB and OFB modes respectively.
3DES:
Uses 8 byte buffer and 2x8 byte key for the two keys
EVP_des_ede_cbc(),
EVP_des_ede(),
EVP_des_ede_ofb(),
EVP_des_ede_cfb()
Two key triple DES in CBC, ECB, CFB and OFB modes respectively.
3DES 3keys:
Uses 8 byte buffer and 3x8 byte key for the 3 8 byte keys.
EVP_des_ede3_cbc(),
EVP_des_ede3(),
EVP_des_ede3_ofb(),
EVP_des_ede3_cfb()
Three key triple DES in CBC, ECB, CFB and OFB modes respectively.
DESX:
--> BOOK !!
EVP_desx_cbc()
DESX algorithm in CBC mode.
const EVP_CIPHER *EVP_des_ecb();
const EVP_CIPHER *EVP_des_ede();
const EVP_CIPHER *EVP_des_ede3();
const EVP_CIPHER *EVP_des_ede_ecb();
const EVP_CIPHER *EVP_des_ede3_ecb();
const EVP_CIPHER *EVP_des_cfb64();
# define EVP_des_cfb EVP_des_cfb64
const EVP_CIPHER *EVP_des_cfb1();
const EVP_CIPHER *EVP_des_cfb8();
const EVP_CIPHER *EVP_des_ede_cfb64();
# define EVP_des_ede_cfb EVP_des_ede_cfb64
#if 0
const EVP_CIPHER *EVP_des_ede_cfb1();
const EVP_CIPHER *EVP_des_ede_cfb8();
#endif
const EVP_CIPHER *EVP_des_ede3_cfb64();
# define EVP_des_ede3_cfb EVP_des_ede3_cfb64
const EVP_CIPHER *EVP_des_ede3_cfb1();
const EVP_CIPHER *EVP_des_ede3_cfb8();
const EVP_CIPHER *EVP_des_ofb();
const EVP_CIPHER *EVP_des_ede_ofb();
const EVP_CIPHER *EVP_des_ede3_ofb();
const EVP_CIPHER *EVP_des_cbc();
const EVP_CIPHER *EVP_des_ede_cbc();
const EVP_CIPHER *EVP_des_ede3_cbc();
const EVP_CIPHER *EVP_desx_cbc();
RC4:
EVP_rc4()
RC4 stream cipher. This is a variable key length cipher with
default key length 128 bits.
#ifndef OPENSSL_NO_RC4
const EVP_CIPHER *EVP_rc4();
const EVP_CIPHER *EVP_rc4_40();
#endif
RC4_40:
EVP_rc4_40()
RC4 stream cipher with 40 bit key length. This is obsolete and new
code should use EVP_rc4() and the EVP_CIPHER_CTX_set_key_length()
function.
IDEA:
EVP_idea_cbc(),
EVP_idea_ecb(),
EVP_idea_cfb(),
EVP_idea_ofb()
IDEA encryption algorithm in CBC, ECB, CFB and OFB modes
respectively.
#ifndef OPENSSL_NO_IDEA
const EVP_CIPHER *EVP_idea_ecb();
const EVP_CIPHER *EVP_idea_cfb64();
# define EVP_idea_cfb EVP_idea_cfb64
const EVP_CIPHER *EVP_idea_ofb();
const EVP_CIPHER *EVP_idea_cbc();
#endif
RC2:
EVP_rc2_cbc(),
EVP_rc2_ecb(),
EVP_rc2_cfb(),
EVP_rc2_ofb()
RC2 encryption algorithm in CBC, ECB, CFB and OFB modes
respectively. This is a variable key length cipher with an
additional parameter called "effective key bits" or "effective key
length". By default both are set to 128 bits.
#ifndef OPENSSL_NO_RC2
const EVP_CIPHER *EVP_rc2_ecb();
const EVP_CIPHER *EVP_rc2_cbc();
const EVP_CIPHER *EVP_rc2_40_cbc();
const EVP_CIPHER *EVP_rc2_64_cbc();
const EVP_CIPHER *EVP_rc2_cfb64();
# define EVP_rc2_cfb EVP_rc2_cfb64
const EVP_CIPHER *EVP_rc2_ofb();
#endif
RC2-40:
RC2-64:
EVP_rc2_40_cbc(), EVP_rc2_64_cbc()
RC2 algorithm in CBC mode with a default key length and effective
key length of 40 and 64 bits. These are obsolete and new code
should use EVP_rc2_cbc(), EVP_CIPHER_CTX_set_key_length() and
EVP_CIPHER_CTX_ctrl() to set the key length and effective key
length.
BLOWFISH:
EVP_bf_cbc(),
EVP_bf_ecb(),
EVP_bf_cfb(),
EVP_bf_ofb();
Blowfish encryption algorithm in CBC, ECB, CFB and OFB modes
respectively. This is a variable key length cipher.
#ifndef OPENSSL_NO_BF
const EVP_CIPHER *EVP_bf_ecb();
const EVP_CIPHER *EVP_bf_cbc();
const EVP_CIPHER *EVP_bf_cfb64();
# define EVP_bf_cfb EVP_bf_cfb64
const EVP_CIPHER *EVP_bf_ofb();
#endif
CAST:
EVP_cast5_cbc(),
EVP_cast5_ecb(),
EVP_cast5_cfb(),
EVP_cast5_ofb()
CAST encryption algorithm in CBC, ECB, CFB and OFB modes
respectively. This is a variable key length cipher.
#ifndef OPENSSL_NO_CAST
const EVP_CIPHER *EVP_cast5_ecb();
const EVP_CIPHER *EVP_cast5_cbc();
const EVP_CIPHER *EVP_cast5_cfb64();
# define EVP_cast5_cfb EVP_cast5_cfb64
const EVP_CIPHER *EVP_cast5_ofb();
#endif
RC5:
EVP_rc5_32_12_16_cbc(), EVP_rc5_32_12_16_ecb(),
EVP_rc5_32_12_16_cfb(), EVP_rc5_32_12_16_ofb()
RC5 encryption algorithm in CBC, ECB, CFB and OFB modes
respectively. This is a variable key length cipher with an
additional "number of rounds" parameter. By default the key length
is set to 128 bits and 12 rounds.
#ifndef OPENSSL_NO_RC5
const EVP_CIPHER *EVP_rc5_32_12_16_cbc();
const EVP_CIPHER *EVP_rc5_32_12_16_ecb();
const EVP_CIPHER *EVP_rc5_32_12_16_cfb64();
# define EVP_rc5_32_12_16_cfb EVP_rc5_32_12_16_cfb64
const EVP_CIPHER *EVP_rc5_32_12_16_ofb();
#endif
#if 0
# ifdef OPENSSL_OPENBSD_DEV_CRYPTO
const EVP_CIPHER *EVP_dev_crypto_des_ede3_cbc();
const EVP_CIPHER *EVP_dev_crypto_rc4();
const EVP_MD *EVP_dev_crypto_md5();
# endif
#endif
#ifndef OPENSSL_NO_AES
const EVP_CIPHER *EVP_aes_128_ecb();
const EVP_CIPHER *EVP_aes_128_cbc();
const EVP_CIPHER *EVP_aes_128_cfb1();
const EVP_CIPHER *EVP_aes_128_cfb8();
const EVP_CIPHER *EVP_aes_128_cfb128();
# define EVP_aes_128_cfb EVP_aes_128_cfb128
const EVP_CIPHER *EVP_aes_128_ofb();
#if 0
const EVP_CIPHER *EVP_aes_128_ctr();
#endif
const EVP_CIPHER *EVP_aes_192_ecb();
const EVP_CIPHER *EVP_aes_192_cbc();
const EVP_CIPHER *EVP_aes_192_cfb1();
const EVP_CIPHER *EVP_aes_192_cfb8();
const EVP_CIPHER *EVP_aes_192_cfb128();
# define EVP_aes_192_cfb EVP_aes_192_cfb128
const EVP_CIPHER *EVP_aes_192_ofb();
#if 0
const EVP_CIPHER *EVP_aes_192_ctr();
#endif
const EVP_CIPHER *EVP_aes_256_ecb();
const EVP_CIPHER *EVP_aes_256_cbc();
const EVP_CIPHER *EVP_aes_256_cfb1();
const EVP_CIPHER *EVP_aes_256_cfb8();
const EVP_CIPHER *EVP_aes_256_cfb128();
# define EVP_aes_256_cfb EVP_aes_256_cfb128
const EVP_CIPHER *EVP_aes_256_ofb();
const EVP_CIPHER *EVP_aes_256_ctr();
In cryptography, Camellia is a block cipher that has been evaluated favorably
by several organisations, including the European Union's NESSIE project (a
selected algorithm), and the Japanese CRYPTREC project (a recommended
algorithm). The cipher was developed jointly by Mitsubishi and NTT in 2000,
and has similar design elements to earlier block ciphers (MISTY1 and E2) from
these companies.
Camellia has a block size of 128 bits, and can use 128-bit, 192-bit or 256-bit
keys - the same interface as the Advanced Encryption Standard. It is a
Feistel cipher with either 18 rounds (if the key is 128 bits) or 24 rounds (if
the key is 192 or 256 bits). Every six rounds, a logical transformation layer
is applied: the so-called "FL-function" or its inverse. Camellia uses four 8 x
8-bit S-boxes with input and output affine transformations and logical
operations. The cipher also uses input and output key whitening. The diffusion
layer uses a linear transformation based on an MDS matrix with a branch number
of 5.
On June, 18 2008, support for the adopted Camellia cipher was added to the
final release of Mozilla Firefox 3.[citation needed]
http://en.wikipedia.org/wiki/Camellia_(cipher)
const EVP_CIPHER *EVP_camellia_128_ecb();
const EVP_CIPHER *EVP_camellia_128_cbc();
const EVP_CIPHER *EVP_camellia_128_cfb1();
const EVP_CIPHER *EVP_camellia_128_cfb8();
const EVP_CIPHER *EVP_camellia_128_cfb128();
# define EVP_camellia_128_cfb EVP_camellia_128_cfb128
const EVP_CIPHER *EVP_camellia_128_ofb();
const EVP_CIPHER *EVP_camellia_192_ecb();
const EVP_CIPHER *EVP_camellia_192_cbc();
const EVP_CIPHER *EVP_camellia_192_cfb1();
const EVP_CIPHER *EVP_camellia_192_cfb8();
const EVP_CIPHER *EVP_camellia_192_cfb128();
# define EVP_camellia_192_cfb EVP_camellia_192_cfb128
const EVP_CIPHER *EVP_camellia_192_ofb();
const EVP_CIPHER *EVP_camellia_256_ecb();
const EVP_CIPHER *EVP_camellia_256_cbc();
const EVP_CIPHER *EVP_camellia_256_cfb1();
const EVP_CIPHER *EVP_camellia_256_cfb8();
const EVP_CIPHER *EVP_camellia_256_cfb128();
# define EVP_camellia_256_cfb EVP_camellia_256_cfb128
const EVP_CIPHER *EVP_camellia_256_ofb();
#ifndef OPENSSL_NO_SEED
const EVP_CIPHER *EVP_seed_ecb();
const EVP_CIPHER *EVP_seed_cbc();
const EVP_CIPHER *EVP_seed_cfb128();
# define EVP_seed_cfb EVP_seed_cfb128
const EVP_CIPHER *EVP_seed_ofb();
#endif
*/
#endif
|