Re: encryption question
- From: Henrick Hellström <henrick@xxxxxxxxxxxx>
- Date: Tue, 29 Jan 2008 16:57:47 +0100
Rael wrote:
I would like to use an encryption method where no record of the secret key is kept. (If the correct key is supplied the data will be unencrypted correctly otherwise a meaningless stream will be returned.)
But how to know if the user has entered the correct password?
Given that you don't have any further requirements, your code doesn't have to know if the user entered the correct password or not. Simply use whatever is entered as input to a Key Derivation Function. The output of the KDF will be used as the actual encryption key. If the user enters the correct password at decryption time the KDF will return the correct key and the cipher text will be decrypted correctly. If the user enters the wrong password the KDF will (being a deterministic pseudo random function) return some other key and the cipher text will decrypt to garbage. It doesn't have to be any harder than that (but of course it might be harder if you have additional requirements).
If I keep a "test" string stored somewhere, where I know what this string value should be when unencrypted, will this comprimise security? IOW, if a hacker has access to an encrypted string and knows what the unencrypted value of this string is, can he work out the secret key?
That, most likely, ultimately depends on the strength of your password. There has been some discussion about it in news://news.streamsec.net/streamsec.public.tools.cryptography.
Basically, the strength of your password will never exceed L*ln(C)/ln(2), where L is the number of characters in the password and C is the number of characters in the alphabet you are using. For instance, if C is 64 (e.g. A-Z, a-z, 0-9 and a few other characters), ln(C)/ln(2) = 6, and a password of length 8 will never exceed a strength corresponding to 48 bits. If you want 128 bits of security you will need a password at least 21 characters in length. If it contains any patterns you have chosen in order to make it easier to remember the password has to be even longer.
I would like to know if the answer to this question depends on algorithm used (i.e. public/private key pair or straightforward encryption (blowfish?)). I will probably be using an encryption method from freeware components streamsec or DCPCrypt.
Not likely, no. The weakest point is almost always either the password of the user, or the way the application developer uses the algorithms.
.
- References:
- encryption question
- From: Rael
- encryption question
- Prev by Date: Re: encryption question
- Next by Date: Re: encryption question
- Previous by thread: Re: encryption question
- Next by thread: Re: encryption question
- Index(es):
Relevant Pages
|