#include "Slot.h"
#include "Crypto.h"
#include "ByteBuffer.h"
+#include "aes.h"
#include <sys/socket.h>
#include <unistd.h>
}
Array<char> *AESEncrypt(Array<char> *ivBytes, AESKey *key, Array<char> *data) {
- return NULL;
+ Array<char> * output=new Array<char>(data->length());
+ aes_encrypt_ctr((BYTE *)data->internalArray(), data->length(), (BYTE *) output->internalArray(), (WORD *)key->getKey()->internalArray(), key->getKey()->length()/(sizeof(WORD)/sizeof(BYTE)), (BYTE *)ivBytes->internalArray());
+ return output;
}
Array<char> *AESDecrypt(Array<char> *ivBytes, AESKey *key, Array<char> *data) {
- return NULL;
+ Array<char> * output=new Array<char>(data->length());
+ aes_decrypt_ctr((BYTE *)data->internalArray(), data->length(), (BYTE *)output->internalArray(), (WORD *)key->getKey()->internalArray(), key->getKey()->length()/(sizeof(WORD)/sizeof(BYTE)), (BYTE *)ivBytes->internalArray());
+ return output;
}
Array<char> *CloudComm::encryptSlotAndPrependIV(Array<char> *rawData, Array<char> *ivBytes) {