Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

This question already has an answer here:

I need to encrypt a file with a password that can be memorized. So I was thinking about running the password through some rounds of Bcrypt before using it for AES encryption, so every time I want to encrypt/decrypt I want it to take about 10 seconds in my machine (meaning brute-forcing it wouldn't be possible).

What I want to ask you is whether doing this is 0K, since normally one shouldn't mess around with cryptography. Doesn't AES have this already built-in? I mean configurable number of rounds or something.

share|improve this question
Possible duplicate of Security of bcrypt/sha256 key used with AES to encrypt a file. –  TildalWave Jun 8 '13 at 19:02
add comment

marked as duplicate by TildalWave, Polynomial, Jeff Ferland Jun 8 '13 at 21:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

There are many gotchas in the overall approach so I'll pick a narrow path.

First off, AES does NOT have any such thing in-built. It just takes a key and does it's job. There are no artificial "work factors" built into it.

Secondly, folks rarely "brute force" the password - they use dictionary based attacks along with a long list of permutation rules to try out "likely" password.

For your purpose, you can use either bcrypt, scrypt or pbkdf2 to slow down dictionary attacks. I would still recommend using longer pass phrases and also salting the keyboard password before it enters bcrypt/script or pbkdf2.

You should know that between you entering the "in-your-mind" password on your keyboard and the AES crypto library getting the real AES key, there can be many potential areas of weakness. eg: If you copy-paste the bcrypt output (=AES key?) into some other program (encryption program?), it's on your clipboard for ANY program to snoop on.

share|improve this answer
Why would I add a salt? Doesn't bcrypt already do that? –  ChocoDeveloper Jun 9 '13 at 2:18
Yes, bcrypt can accept a salt value in it's input but you still have to actually provide/store it. Basically don't pass null or zeros taking any short cuts. You might not but just saying .... –  DeepSpace101 Jun 9 '13 at 3:31
add comment

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