Archived Forum Post

Index of archived forum posts

Question:

Does the Length of a Password for AES Encryption Make it More Secure?

Oct 18 '13 at 10:57

Does the length of the encryption password have any relationship to the security of the file? Is the security of the file simply related to the ability to guess the password.


Answer

The guessability of a password is by far the most important factor in the security of any encryption based on a password. This means that a password that is difficult to guess, and one that is unlikely to be generated through a brute-force attack, is known as a strong password. A weak password is the opposite.

AES encryption can have 3 possible binary secret key lengths: 128-bits, 192-bits, and 256-bits. The longer the key length, the stronger the encryption. Anytime a password string is used for AES encryption, what must happen is that the arbitrary-sized password must be transformed in some way (usually a hash algorithm) to get a binary secret key of the selected size (128-bits, which is 16 bytes, or 192-bits, or 256-bits).

A weak password used to generate a 256-bit AES key is far less secure than a strong password used to generate a 128-bit key.

Regarding passwords: Avoid using non-us-ascii chars in your password. In other words, I would recommend against using any 8bit non-English chars in your password. Using non-letter and non-number chars is good, such as punctuation and other symbols, as long as they are printable us-ascii chars. Why do I say this? Because when 8bit chars are used, it opens this question: What character encoding (i.e. byte representation) of the password is used to generate the binary secret key? Visually, the password may look the same, but if software differs in the underlying byte representation (such as utf-8 vs. ANSI) then the binary secret key will be different. You may find yourself in the position where encrypting on one software system works, but decrypting w/ another software system does not work. (With Chilkat, you can control the character encoding, so you always have the flexibility.) Why cause yourself potential future problems? Just avoid using 8bit chars. You can get the same security (i.e. strong password) by simply using a longer password with us-ascii chars.


Answer

The short answer is:

1) Use a strong password (not overly long but with a good mix of letters, numbers and casing), and avoid non printable characters.

2) No matter how "strong" your password is, if you don't keep it safe, nothing else would be secure. This is referenced as Key Management (http://en.wikipedia.org/wiki/Key_management).

3) Bit strength matters way less than #1 and #2 above. AES-128 provides more than enough security margin for the (foreseeable) future. But if you're already using AES-256, there's no reason to change.