7

I was wondering if an adversary have your private gpg key but not the password/phrase, how easy/difficult would it be to crack a encrypted file compared to a encryption that only use password and not keys? (assuming that the password was the same).

would a compromised keyfile make it easier to crack the encryption, than a encryption that don't use keyfiles or would it equal out?

An example could be a gpg encrypted file where the private key has been stolen and a file encrypted with AEScrypt.

2 Answers 2

11

If you have a GPG private key that is locked with a password, "cracking" the key reduces to password guessing. There's a easy equation to answer that; what's hard is that there are two unknowns: the number of bits of entropy in the password and the number of guesses per second an attacker can make.

Example: There are 96 printable ASCII characters. Log2(96) is about 6.6. Given an eight character ASCII password, truly randomly generated, one would have 6.6x8=52.8 bits of entropy. If an attacker can make a billion (230) guesses per second, it will take about 222.8 seconds or about 84 days to try all combinations. Since we expect an attacker to "hit" about halfway through, average time to crack will be around 42 days.

If, instead, the password is one of the top 10,000 (and crackers have lists!) you have about 13.3 bits of entropy and cracking will succeed in less than a second.

Finally, suppose you used Diceware with a 6 word pass phrase. You'd get 66 bits of entropy and cracking would take about 235 seconds, or over a thousand years.

You can repeat the arithmetic with other values of guesses per second.

There are two important things to glean from this. First, if private key is locked with a password and the attacker has access to the locked private key, cracking is all about the password, and not about GPG or public key crypto at all. Second, every bit of entropy added to a password approximately doubles the time to crack it by brute force.

For an AES key derived from a password, the calculations are the same. However, an AES key does not have to be derived from a password. It can be randomly generated. For 128-bit AES, the brute-force attacker will take 2128-30-1 = 297 seconds. That's about 5,000,000,000,000,000,000,000 years.

2
  • 1
    So, the answer is that they would be crackable in similar times since both are just dictionary attacks cracking symmetric encryptions. If the OP is referring to AES Crypt the open source file format, then you would normally not use a random password.
    – Phil_1984_
    Commented Jan 25, 2015 at 0:24
  • 1
    It depends on the algorithm used by gpg to encrypt the secret key. There is a interesting blog post about it. With gpg --list-packets ~/.gnupg/secring.gpg you can check which one is used. My current gpg 2.0.29 still uses CAST5 and SHA1 hashing by default. It is possible (and I encourage you) to change that. Still, the most important thing is a good passphrase. (even better is to store the key on a Smartcard)
    – Josef
    Commented Nov 4, 2015 at 11:40
0

I would be faster to crack the private key if it was protected by a password and not key file as a key file would most likely contain more character than your password which means it would take more computation to generate key file in a brute force attack. It would be easier to crack the encryption if the attacker had the password protected private key. As he would only need to crack the password. If he didn't have the protected private key he would need to generate eg. 1024 bit private key this takes more time than brute forcing a password.

2
  • thanks.. but would it be faster than cracking an encryption that don't use a keyfile (like AEScrypt)? or would be equally strong/vulnerable? because the password is the only obstacle in both cases?
    – HC Haase
    Commented Jan 3, 2015 at 14:14
  • If you were using and the attacker had possession of it. using a keyfile it would make a attack slower but not my much. Because you enter the password keyfile gets unlocked then keyfile gets sent to gpg and runs it against private key. Unlocking keyfile takes time. sending keyfile eg. 512bit long to would take gpg longer to process than a 8 character password
    – Tim Jonas
    Commented Jan 3, 2015 at 15:00

You must log in to answer this question.

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