I'm developing an application that will use public key authentication to contact some webservice. So the user has his keypair on his computer, and I want that file to be encrypted using AES with a key derived from a user's password.
I'm wondering if I'm using relatively "safe" parameters and way of writing the file.
Here are the PBKDF2 and AES parameters:
- PBKDF2 Iterations : 1024
- PBKDF2 Hash function : SHA256
- PBFDF2 Salt size : 256 bits
- PBKDF2 Derived key size : 256 bits
- AES Cipher mode : CFB
Here is how the file is written:
- Salt (Hex encoded)
- Return line
- IV (Hex encoded)
- Return line
- Encrypted file content (Hex encoded, encrypted using AES in CFB mode and the key derived from the user's password)
Maybe what's missing here is a HMAC (with SHA256, for example) to "guarantee" that the file hasn't been tampered with. Here's how probably I'd append it to the file, after "Encrypted file content":
- Return line
- HMAC-SHA256 with the content's encryption key
Thanks in advance.