Reputation: 730
I have an API that decrypts data. This API receives only key (bytes of an AES key). This API does not receive initialization vector (It uses vector of zeros as an initialization vector).
I'm receiving from 3rd party an encrypted data. This data was encrypted to AES 256 using a specific key and initialization vector.
I have the key and the initialization vector. Is there a way to decrypt this data using the API? or, in other words, if the key and the initialization vector are constants and I have them both, can I create a key that will allow me to decrypt this data with a {0, 0, 0, ...} initialization vector?
Thanks.
Upvotes: 0
Views: 337
Reputation: 10257
Yes it is possible to decrypt ... no not the way you described
AES is a block cipher
most of the time the cipher isn't used as it is, but it is put into a special mode of operation (this is what your API probably is not capable of)
you will have to implement the decryption routine around the cipher and use your AES-API just as a crypto-primitive
for example, the decryption of AES-CBC using a generic AES implementation
split ciphertext into 128 bit blocks and number them from index 1 onward
prepend the IV as cypher_block 0
now to obtain the plaintext we can define a function around your API function
plaintext_block[i] = cypher_block[i-1] XOR aes_decrypt(cypher_block[i],key)
as you can see, you can obtain all plaintext blocks from index 1 onward ...
once you have obtained all plaintext blocks you will probably want to strip padding, but that's another story ...
Upvotes: 1