9

Let's say an attacker knows the encrypted content, the decrypted content and the algorithm used: can he get the key that was used to encrypt the content or does it make it easier to find the key out?

I think that this may vary between symmetric and asymmetric encryption and between different algorithms. So how secure is this scenario with different algorithms if the only thing I need to keep secret is the key?


EDIT:

I ask this question because I just read through the SpiderOak FAQ and as far as I understood that, they are neither storing a user's password nor the encryption key which is derivered from the user's password. However, they need to make sure that the user's password is the right one when he's logging in to the web page.

If they don't store the password and don't store the key, the only possibility to check whether the password is right is to decrypt some known encrypted data and check whether the result is the right one.

E.g. when registering they might encrypt the data CHECK and when logging in they might derive a key from the entered password and decrypt the encrypted CHECK and see whether it is CHECK. If not, the key was not right, and thus the password wasn't either.

Is there any other way how they could do it?

  • 1
    Well the entire point is to keep the plaintext secret. If the attacker already has it they don't' really care about the key. It's the "only thing to keep secret" because it's the most important thing. If you're reusing a symmetric key for encryption, then you're already in a bad spot. – RoraΖ Sep 30 '14 at 19:29
  • @raz I've updated the question so you know why I've asked it. Is there any other way how they could do it or do they have to do it if they do not store the password? – MinecraftShamrock Sep 30 '14 at 19:38
  • The standard practice would be for them to store a hash of the password. To verify you are you they take the password you provide in the login, hash it and compare it to the stored password. Well that is simplistic in reality hopefully they would salt the password and use a multiround KDF but the same concept applies. Unlike encryption hashing is a one way process. – Gerald Davis Jul 1 '15 at 0:39
9

What you are referring to is a known-plaintext attack, where you attempt to figure out the key by comparing the encrypted and unencrypted versions of a sample of data. Fortunately, pretty much all major encryption algorithms in use today, including AES, are not known to be susceptible to this kind of attack. Knowing what something decrypts to is completely useless as far as figuring out the key goes (unless, perhaps, your approach is to attempt to brute-force the key.)

While Spideroak technically could use the method you describe (i.e, encrypting a known sample file), they actually use a procedure known as hashing according to their website. Hashing is a very common password storage technique; in fact it is used by nearly all websites that process user logins. It's is a mathematical process that takes in some data (such as a password) as input, and generates a unique, fixed-length string as output. It is easy to calculate the hash of some data, but given the hash, it is very hard to figure out what the original data was. But as long as you provide the same data, the hash will always come out the same.

According to Spideroak, when you create an account, your browser calculates the bcrypt hash of your password and sends the hash to spideroak. Presumably, when you log in, spideroak sends the hash back to your browser, and your browser will take the hash of whatever you typed in to check that it matches.

  • 2
    Technically, you can recover the key given a plaintext and ciphertext with some algorithms (notably, XOR-based OTPs). However, with OTPs, keys are never reused so gaining the key for one message doesn't help you. – Stephen Touset Sep 30 '14 at 22:29
  • 1
    When you think about it Public Key Cryptography would be useless if it was significantly easier to break encryption with both plaintext and crypto text, since someone encrypting data with a public key would have both sets of data as a matter of course. – DodgyG33za Oct 1 '14 at 4:55

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.