summaryrefslogtreecommitdiffstats
path: root/src/PolarSSL++/AesCfb128Encryptor.h
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-05-01 20:50:40 +0200
committerTycho <work.tycho+git@gmail.com>2014-05-01 20:50:40 +0200
commit8780b324ff075f17358b01bc3615da0397fbe8be (patch)
treed448ab665fd50cca3861e06654f8668a89c8d953 /src/PolarSSL++/AesCfb128Encryptor.h
parentAdded Testing capability (diff)
parentFixed MSVC2013 compilation. (diff)
downloadcuberite-8780b324ff075f17358b01bc3615da0397fbe8be.tar
cuberite-8780b324ff075f17358b01bc3615da0397fbe8be.tar.gz
cuberite-8780b324ff075f17358b01bc3615da0397fbe8be.tar.bz2
cuberite-8780b324ff075f17358b01bc3615da0397fbe8be.tar.lz
cuberite-8780b324ff075f17358b01bc3615da0397fbe8be.tar.xz
cuberite-8780b324ff075f17358b01bc3615da0397fbe8be.tar.zst
cuberite-8780b324ff075f17358b01bc3615da0397fbe8be.zip
Diffstat (limited to 'src/PolarSSL++/AesCfb128Encryptor.h')
-rw-r--r--src/PolarSSL++/AesCfb128Encryptor.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/PolarSSL++/AesCfb128Encryptor.h b/src/PolarSSL++/AesCfb128Encryptor.h
new file mode 100644
index 000000000..9dbb5d2c3
--- /dev/null
+++ b/src/PolarSSL++/AesCfb128Encryptor.h
@@ -0,0 +1,50 @@
+
+// AesCfb128Encryptor.h
+
+// Declares the cAesCfb128Encryptor class encrypting data using AES CFB-128
+
+
+
+
+
+#pragma once
+
+#include "polarssl/aes.h"
+
+
+
+
+
+/** Encrypts data using the AES / CFB (128) algorithm */
+class cAesCfb128Encryptor
+{
+public:
+ cAesCfb128Encryptor(void);
+ ~cAesCfb128Encryptor();
+
+ /** Initializes the decryptor with the specified Key / IV */
+ void Init(const Byte a_Key[16], const Byte a_IV[16]);
+
+ /** Encrypts a_Length bytes of the plain data; produces a_Length output bytes */
+ void ProcessData(Byte * a_EncryptedOut, const Byte * a_PlainIn, size_t a_Length);
+
+ /** Returns true if the object has been initialized with the Key / IV */
+ bool IsValid(void) const { return m_IsValid; }
+
+protected:
+ aes_context m_Aes;
+
+ /** The InitialVector, used by the CFB mode encryption */
+ Byte m_IV[16];
+
+ /** Current offset in the m_IV, used by the CFB mode encryption */
+ size_t m_IVOffset;
+
+ /** Indicates whether the object has been initialized with the Key / IV */
+ bool m_IsValid;
+} ;
+
+
+
+
+