Rudiments: /home/dmuse/temp/rudiments/include/rudiments/encryption.h Source File

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
10 enum encryptionerror_t {
11 ENCRYPTION_ERROR_SUCCESS=0,
12 ENCRYPTION_ERROR_NULL,
13 ENCRYPTION_ERROR_INVALID_PADDING,
14 ENCRYPTION_ERROR_UNSUPPORTED
15 };
16
18 class RUDIMENTS_DLLSPEC encryption {
19 public:
21 encryption();
22
24 virtual ~encryption();
25
31 virtual bool setKey(const unsigned char *key,
32 size_t keysize);
33
36 virtual void setRandomKey();
37
40 virtual unsigned char *getKey();
41
43 virtual uint32_t getKeySize()=0;
44
51 virtual bool setIv(const unsigned char *iv, size_t ivsize);
52
56 virtual void setRandomIv();
57
61 virtual unsigned char *getIv();
62
64 virtual uint32_t getIvSize()=0;
65
69 virtual bool append(const unsigned char *data,
70 uint32_t size);
71
77 virtual const unsigned char *getEncryptedData()=0;
78
80 virtual uint64_t getEncryptedDataSize();
81
87 virtual const unsigned char *getDecryptedData()=0;
88
90 virtual uint64_t getDecryptedDataSize();
91
96 virtual bool clear();
97
99 virtual encryptionerror_t getError();
100
101 #include <rudiments/private/encryption.h>
102 };
103
104 #endif
encryption
Definition: encryption.h:18
encryption::~encryption
virtual ~encryption()
encryption::append
virtual bool append(const unsigned char *data, uint32_t size)
encryption::getKeySize
virtual uint32_t getKeySize()=0
encryption::clear
virtual bool clear()
encryption::setKey
virtual bool setKey(const unsigned char *key, size_t keysize)
encryption::getIv
virtual unsigned char * getIv()
encryption::getEncryptedData
virtual const unsigned char * getEncryptedData()=0
encryption::getIvSize
virtual uint32_t getIvSize()=0
encryption::getKey
virtual unsigned char * getKey()
encryption::getError
virtual encryptionerror_t getError()
encryption::setRandomIv
virtual void setRandomIv()
encryption::getEncryptedDataSize
virtual uint64_t getEncryptedDataSize()
encryption::getDecryptedData
virtual const unsigned char * getDecryptedData()=0
encryption::setIv
virtual bool setIv(const unsigned char *iv, size_t ivsize)
encryption::getDecryptedDataSize
virtual uint64_t getDecryptedDataSize()
encryption::encryption
encryption()
encryption::setRandomKey
virtual void setRandomKey()