Re: encryption question



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.
.



Relevant Pages

  • RE: XP password and encryption
    ... Windows NT 4 (I can't remember if it was part of the SP2 upgrade to ... (effectively limited to 14 characters), ... a one-way (non-reversible encryption) of variable size. ... > We provide Ethical Hacking, Advanced Ethical Hacking, Intrusion ...
    (Security-Basics)
  • Re: Question about bit strength
    ... Make good guesses about strength of an encryption soultion is not very ... The algorithms used to derive the key and for actual encryption process ... If an attack exist that can lead to expose the secret factor ... algorithm is at most equal to the number of steps needed to break it; ...
    (sci.crypt)
  • Re: Safe password?
    ... > I use an encryption program that uses AES-256 as its encryption ... > characters for this encryption type? ... The keyspace, expecially in the second case, would be far from the one ... collision resistent hash) to a random key of the length you desire; ...
    (sci.crypt)
  • Re: encryption
    ... advantages over 64-bit encryption if one chooses a password which is 8 ... characters or less? ... One of my pass phrases has more than 15 characters, ... and kept in a Keychain-like system. ...
    (comp.sys.mac.system)
  • Re: Storing input into a character array
    ... char enc; ... slots in the array enc until enc is filled up. ... If you don't want newline characters in your array, ... encryption, it does correctly output the 4 characters of the first row ...
    (comp.lang.c)