I have a block of data crypted using twofish with a key of 128 bit.
The data must be accessed from a GUI, the user gives the key, the block is decoded and the real data is accessed.
Problem is that I need to be sure that the key is correct before trying to decode the block.
My current solution is to have a file (say
chk.blk) that is the encryption of some data I can use to test the correcteness of the key.
Initially I had a file
chk.blk being the encryption of a known data (say the text
12345678) then I thought that this could compromise the key. Is that true? Is there any weakness in twofish if the attacker has both the original and the encrypted data?
Fearing this could be the case, I now generate a random text with a given property (e.g.
. is any character different from
x). I take the key, decode
chk.blk and verify the result has the desired property. The idea is that now the attacker does not have a known text to use but a rather large group of them. Of course I can't be sure that the key is really correct, the user might have taken, by chance, a key that produces a decoded text which have exactly the desired property, but I think the probability is extremely low. Do you think there any issue with this approach?
I'm adding some more info here to clarify the intended usage.
Imagine you have a rather big set of documents (5Mb of data) that must be sent to a large number of recipients (say 10.000). Those documents have to be kept absolutely secret until a given date/time (say 21 Dec 2012 21:12).
Between now and then all the reciepients will be able to download the documents along with a decryption program on their PC. They will reach their designated destination and will wait there to receive the decoding key at the proper time.
Exact syncronization is not important but they all have to read the documents at (almost) the same time.
It is absolutely mandatory that none of them can read the documents before the given date.
They will be located in places where they might not be connected to the internet, that's why they have to download the docuemnts beforehand.
They will all, however, be able to receive a message with the key (e.g. via SMS, via phone, broadcasted by a TV channel or a radio number station, ...).
So, the idea is to distribute the documents encripted with 128 bits of security, which should be enough to protect the key for few months, and then distribute the key as a string (26 characters).