Re: Newbie - Does This Make Sense?
- From: "Joseph Ashwood" <ashwood@xxxxxxx>
- Date: Sat, 21 Aug 2010 18:27:54 -0700
"Larry Lindstrom" <larryl_turbo@xxxxxxxxxxx> wrote in message news:i4kk7k$980$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The reason for keeping the count in the second byte is to take advantage of whatever protection chaining has to offer. Would I benefit from putting more random bytes before the count? Do I benefit from having any random bytes before the count?
That's the picture. Any suggestions?
First suggestion: Take Paul's advice to use an encrypted hard drive.
Assuming that is unacceptable. First pad to a known size, so for example names should be padded to (k*32)-sizeof(length) characters, prepend the real length to the plaintext, this eliminates most of the length leakage, since your database has a maximum size for each field this is a convenient maximum length to use. Just pad with 0s, a pRNG won't affect the security.
For passphrase verification use N iterations of
T[0] = 0x000....000
T[i] = HMAC-SHA-256(T[i-1], passphrase)
store <T[N], N>, an N of 50,000 should be fine. A simple check against this value will detect bad passphrase entry with little leakage.
For the key itself use N iterations of
T[0] = 0x000....000
T[i] = HMAC-SHA-256(passphrase, T[i-1]) //Note the difference in operand order
store N the final i value.
For the encryption, I recommend CBC and HMAC, since you've already got the easy makings. The reason for CBC is to make use of the HMAC for the IV, this makes database storage easier
Encryption
plaintext = <HMAC-SHA-256(data) | data>// | is append, HMAC value is first, this is very important
ciphertext = CBC-AES(IV = 0x000....000, data = plaintext)
Decryption should be obvious. There is a risk, when there is a collision of <data, passphrase, N for key> the ciphertext will collide, if this is unacceptable use a counter for IV, and store it along with the ciphertext.
There is no need for a pRNG at all.
Third suggestion: Take Paul's advice to use an encrypted hard drive. I said it before, but it bears repeating.
Joe
.
- Follow-Ups:
- Re: Newbie - Does This Make Sense?
- From: Larry Lindstrom
- Re: Newbie - Does This Make Sense?
- References:
- Newbie - Does This Make Sense?
- From: Larry Lindstrom
- Newbie - Does This Make Sense?
- Prev by Date: Re: Wolfram's rule 30 as a hash function
- Next by Date: Re: A link to a paper on McEliece's scheme
- Previous by thread: Re: Newbie - Does This Make Sense?
- Next by thread: Re: Newbie - Does This Make Sense?
- Index(es):
Relevant Pages
|