Naftuli Tzvi Kay

less info
180 reputation
5
bio website blog.tkassembled.com
location Los Angeles, CA
age
visits member for 1 year, 2 months
seen Mar 21 at 18:16

Jun
23
accepted Implementing PKCS#7 Padding on a Stream of Unknown Length?
May
9
awarded  Scholar
May
9
accepted Does knowledge of original file size provide a cryptographic weakness?
May
9
comment Does knowledge of original file size provide a cryptographic weakness?
Right, and I need to be able to check passphrase validity really quickly without having to read through an entire file of 16GB in length ;)
May
9
comment Does knowledge of original file size provide a cryptographic weakness?
When I start receiving data, I'm not sure of its ultimate size. Therefore, I do a cumulative HMAC-SHA256 on each chunk just to be paranoid. It adds 16 bytes every $c$ bytes, where $c$ is the chunk size, so it's not the most efficient thing in the world, but it should work for my purposes.
May
9
asked Does knowledge of original file size provide a cryptographic weakness?
Feb
27
comment Deriving HMAC key and cipher key from passphrase?
$HMAC$ is basically the RFC-2104 implementation in Python.
Feb
27
comment Validating successful decryption in AES
I'm storing the IV among other data in a JSON string in the header to the file, terminated by a null byte. When computing the MAC, should I essentially compute $HMAC(iv + c, k\_{m})$ where $c$ is the cipher text and $k\_{m}$ is the MAC key? Is that accurate?
Feb
27
comment Deriving HMAC key and cipher key from passphrase?
Quick question on your answer: is the HMAC secure if the appended label is known? In your example above, if someone discovers that the input $label\_{n}$ is "a", is the system still secure? I'd prefer that if my code was open-sourced, no advantage would be gained by a potential attacker.
Feb
26
asked What is the difference between a HMAC and a hash of data?
Feb
26
awarded  Commentator
Feb
26
comment Deriving HMAC key and cipher key from passphrase?
I guess my main problem was in understanding how HMAC(input, salt) is different from HASH(input + salt), but if it works, it works :)
Feb
26
comment Deriving HMAC key and cipher key from passphrase?
So, essentially: hmac.new(master_key, "a", hashlib.sha512).digest() for the HMAC authentication key? Since I need a 256-bit key, would SHA-256 also work?
Feb
26
comment Deriving HMAC key and cipher key from passphrase?
I don't know of any pseudo-random functions. I'm therefore not sure what you're suggesting. Should I use a PRF to generate two salts, then with the two different salts, generate an encryption key and authentication key? (Eg: where $r$ is the output from os.urandom(32) [32 bytes of pseudo-random data], derive the keys like $k\_{n} = sha256(k + r)$?)
Feb
26
comment Deriving HMAC key and cipher key from passphrase?
Lol, was this post a joke? Roll your own crypto? Rely on the fact that your system is "closed-source" to ensure security? Everything about this is wrong.
Feb
24
asked Deriving HMAC key and cipher key from passphrase?
Feb
21
comment Validating successful decryption in AES
The only reason I didn't set out to use a MAC in the first place is because there doesn't seem to be native support in Python as a part of PyCrypto for doing it. I've heard that doing a MAC wrong also can really open up a security hole.
Feb
21
comment Validating successful decryption in AES
Ok, that all makes sense. For (1) above, is it a problem to 'split' hash output into two 16-byte sets? I'm currently using $sha512 \longrightarrow bcrypt \longrightarrow sha256$ for my passphrase. Should I simply make the final step $sha512$ and split the output: half to AES and half to the MAC? Also, on (3): I'm storing the IV in the unencrypted header of the file. Why should I tack it onto the end of the ciphertext?
Feb
21
comment Validating successful decryption in AES
It does, but I can't seem to find it. Is it in the OpenSSL.crypto package? Can't seem to find it here.
Feb
21
comment Validating successful decryption in AES
Wish I could; Python support for authenticated AES modes is terrible (read 'nonexistent').