1

I have a several tuples of raw and encrypted text from a blackbox service.

What would be the most reasonable approach to guess/bruteforce the encryption algorithm and parameters (IV, key) that are being used to produce encrypted text?

and how many samples are required to accomplish the task?

1
  • 1
    If it's using any decent algorithm, you won't be able to use a known-plaintext attack against it.
    – forest
    Commented Dec 12, 2022 at 23:12

1 Answer 1

1

You won't be able to tell what the key is just by having plaintext/ciphertext pairs. Determining the key requires mounting a known-plaintext attack (KPA). Strong ciphers like AES are specifically designed to be resistant to that kind of attack. Even weaker ciphers that are vulnerable to it may require trillions of gigabytes of known plaintext. "Several tuples" is not enough for even the worst ciphers.

Determining the algorithm that is used is likewise not feasible. Even if you could choose the plaintext that are to be encrypted, you cannot distinguish the ciphertext outputs from random data if the cipher is IND-CPA secure. All modern, secure ciphers are IND-CPA secure. Other than that, you could only determine information about the cipher if the format used for encryption gives it away (e.g. a header).

As for determining the IV, this actually might be very easy, depending on the system. If the plaintext is encrypted with a block cipher with n-bit blocks in, say, CBC mode, then the first n bits of ciphertext is usually the IV. Of course, if the IV is randomly chosen, you won't be able to tell if it actually is the IV.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .