I have a .png file that is encrypted, but I know the first characters of the (decrypted) file are the highlighted/selected characters below (as they appear in notepad++). Can I decrypt the file if I don't know the key (but perhaps if I know the algorithm, mode, and/or key length). At worst, perhaps I could only try the key(s) that produce the first few characters and ignore the rest to decrypt it.

decrypted example:

enter image description here

the specific encrypted file's first few characters:

enter image description here


If you know the Algorithm and the Key length, we can tell you how hard it is to break the key. For any decent encryption, the answer will be: no, you cannot decrypt the file without the key.

This is the whole point of encryption! Encryption Algorithms are designed so that they are secure if an attacker knows absolutely everything about it and the only thing he doesn't know is the key. This is called Kerckhoffs's principle

| improve this answer | |
  • Knowing the algorithm would make it possible to perform a known-plaintext attack (in theory). In practice this is way to less data to use this type of attack. – Yorick de Wid Sep 12 '16 at 10:29
  • 1
    Modern ciphers are not known to be susceptible to known-plaintext attacks. So if any decent encryption is used, it won't work. If outdated/bad encryption is used, of course it might be easy to break it. – Josef says Reinstate Monica Sep 12 '16 at 10:35
  • @Josef, algorithm is AES in CBC mode and the key length is likely to be 16. – JavaScriptArray Sep 12 '16 at 11:26
  • 1
    @JavaScriptArray then the answer is: no, you cannot decrypt the file without the key – Josef says Reinstate Monica Sep 12 '16 at 11:57

If modern encryption is used - and you state in a comment to @Josef's post that it is AES - then no, knowing a portion of the unencrypted source data will not help you decrypt it at all.

You are describing a partial known-plaintext attack ("KPA"). To quote Wikipedia,

Modern ciphers such as Advanced Encryption Standard are not currently known to be susceptible to known-plaintext attacks.

A variety of World War II era ciphers - all the way from Playfair to Enigma - were susceptible or weakened by known-plaintext attacks. Modern encryption algorithms are tested for susceptibility to such attacks, and weeded out if found susceptible to it. PKZip's native encryption is an example where a modern encryption system was found vulnerable to KPA (see PkCrack) and subsequently replaced with standards like DES and AES.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.