0
votes

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.

1
Take a look at the diagrams at e.g. en.m.wikipedia.org/wiki/Block_cipher_modes_of_operation to see how the IV is used. - Oliver Charlesworth
I have an API that decrypts data Is there a way to decrypt this data using the API? How can we answer to this if we don't know what API you are using?! - BackSlash
As I mentioned, The API receives the key (as a byte buffer) and the data to decrypt (as a byte buffer) and decrypts the data using AES-256 algorithm, the key. It uses {0, 0, 0, 0, 0...} as an IV (I cannot change this). - Matan

1 Answers

1
votes

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 ...