security - Can I use PBKDF2 to generate an AES256 key to encrypt and implicitly authenticate? -


i have 2 devices , want set secure communication channel between them. shared secret (7- 20- character ascii) passphrase. if use pbkdf2 (from rfc 2898) common salt, iterations, , passphrase generate aes256-cbc key , iv on both sides, think can authenticate user , provide encrypted channel in 1 step. true, or there reason why i've seen people use pbkdf2 verify passwords?

my reasoning both sides need know passphrase generate same key , iv. if device b can decrypt data device a, both have demonstrated have same passphrase.

pbkdf2 fine way generate common key shared secret (you should not generating iv in such way though - iv should random, , sent alongside ciphertext).

however, cbc not authenticating cipher mode. because attacker can take encrypted message , make predictable modifications it, without needing able read message or know key. such attacks have broken real world systems in past.

you can use authenticating cipher mode, galois counter mode (gcm) instead of cbc.

an alternative encrypt-then-mac. use pbkdf2 2 different salts generate 2 different keys - first data encrypted using cbc first key, , hmac calculated on ciphertext using second key.

you need use single-use-nonces prevent replay attacks.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -