#include "Crypto.h"
+#include "pbkdf2-sha256.h"
+
+AESKey::AESKey(Array<char> *password, Array<char> *salt, int iterationCount, int keyLength) {
+ key = new Array<char>(keyLength);
+ PKCS5_PBKDF2_HMAC((unsigned char *) password->internalArray(), password->length(),
+ (unsigned char *) salt->internalArray(), salt->length(),
+ iterationCount, keyLength, (unsigned char *) key->internalArray());
+}
+
+AESKey::~AESKey() {
+ delete key;
+}
--- /dev/null
+#ifndef PBKDF2_SHA256_H
+#define PBKDF2_SHA256_H
+
+void PKCS5_PBKDF2_HMAC(unsigned char *password, size_t plen,
+ unsigned char *salt, size_t slen,
+ const unsigned long iteration_count, const unsigned long key_length,
+ unsigned char *output);
+
+#endif