Rudiments
encryption.h
1// Copyright (c) 1999-2018 David Muse
2// See the COPYING file for more information.
3
4#ifndef RUDIMENTS_ENCRYPTION_H
5#define RUDIMENTS_ENCRYPTION_H
6
7#include <rudiments/private/encryptionincludes.h>
8
10enum encryptionerror_t {
11 ENCRYPTION_ERROR_SUCCESS=0,
12 ENCRYPTION_ERROR_NULL,
13 ENCRYPTION_ERROR_INVALID_KEY_SIZE,
14 ENCRYPTION_ERROR_INVALID_IV_SIZE,
15 ENCRYPTION_ERROR_INPUT_TOO_LONG,
16 ENCRYPTION_ERROR_INVALID_PADDING,
17 ENCRYPTION_ERROR_UNSUPPORTED
18};
19
21class RUDIMENTS_DLLSPEC encryption : virtual public object {
22 public:
25
27 virtual ~encryption();
28
37 virtual bool setKey(const byte_t *key, size_t keysize);
38
41 virtual void setRandomKey();
42
45 virtual byte_t *getKey();
46
48 virtual size_t getKeySize()=0;
49
58 virtual bool setIv(const byte_t *iv, size_t ivsize);
59
63 virtual void setRandomIv();
64
68 virtual byte_t *getIv();
69
71 virtual size_t getIvSize()=0;
72
77 virtual bool append(const byte_t *data, uint32_t size);
78
87 virtual const byte_t *getEncryptedData()=0;
88
90 virtual uint64_t getEncryptedDataSize();
91
100 virtual const byte_t *getDecryptedData()=0;
101
103 virtual uint64_t getDecryptedDataSize();
104
106 virtual encryptionerror_t getError();
107
116 virtual bool clear();
117
125 virtual bool reset();
126
127 #include <rudiments/private/encryption.h>
128};
129
130#endif
Definition encryption.h:21
virtual size_t getKeySize()=0
virtual ~encryption()
virtual byte_t * getIv()
virtual bool clear()
virtual const byte_t * getDecryptedData()=0
virtual bool setKey(const byte_t *key, size_t keysize)
virtual bool append(const byte_t *data, uint32_t size)
virtual size_t getIvSize()=0
virtual bool reset()
virtual encryptionerror_t getError()
virtual void setRandomIv()
virtual uint64_t getEncryptedDataSize()
virtual uint64_t getDecryptedDataSize()
virtual bool setIv(const byte_t *iv, size_t ivsize)
virtual byte_t * getKey()
virtual void setRandomKey()
virtual const byte_t * getEncryptedData()=0
Definition object.h:10