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:
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
Definition: encryption.h:18
virtual ~encryption()
virtual bool append(const unsigned char *data, uint32_t size)
virtual uint32_t getKeySize()=0
virtual bool clear()
virtual bool setKey(const unsigned char *key, size_t keysize)
virtual unsigned char * getIv()
virtual const unsigned char * getEncryptedData()=0
virtual uint32_t getIvSize()=0
virtual unsigned char * getKey()
virtual encryptionerror_t getError()
virtual void setRandomIv()
virtual uint64_t getEncryptedDataSize()
virtual const unsigned char * getDecryptedData()=0
virtual bool setIv(const unsigned char *iv, size_t ivsize)
virtual uint64_t getDecryptedDataSize()
virtual void setRandomKey()