void decrypt(AES_KEY &ctx, decrypt_output_type &dst, const decrypt_input_type &src, iv_type &iv) { // 아직 bits값에 대한 것은 모호함. 조사 필요 int bits = 8; // 패딩이 없어도 된다. AES_ofb128_encrypt(&src[0], &dst[0], src.size(), &ctx, &iv[0], &bits); }
unsigned char * aes_ofb_decrypt(unsigned char * enc, int length, unsigned char * key, unsigned char * iv) { unsigned char * outbuf= calloc(1,length); int num = 0; unsigned char liv[16]; memcpy(liv,iv,16); AES_KEY aeskey; AES_set_encrypt_key(key, 256, &aeskey); AES_ofb128_encrypt(enc, outbuf, length, &aeskey, liv, &num); return outbuf; }
virtual void decrypt(const unsigned char* in, unsigned char* out, std::size_t length) { assert(in && out); AES_ofb128_encrypt(in, out, length, &this->aes_ctx, this->ivec, &this->num); }