PBKDF2 is the most commonly used Password Based Key Derivation scheme and it is present in most Java runtimes, including Android. If you want to use a password, please make sure you do use a good key derivation mechanism (look up password based encryption or password based key derivation). It is always exactly one block (16 bytes) in size. You can prefix the plain IV at the start of the ciphertext. It should be present in any generic cryptographic library, ensuring high compatibility.ĭon't forget to use a Initialization Vector (IV) generated by a secure random generator if you want to encrypt multiple files with the same key. CBC mode is secure and does not have the vulnerabilities of ECB mode for non-random plaintexts. I would suggest something like Cipher.getInstance("AES/CBC/PKCS5Padding") for creating the Cipher class. Use a CipherOutputStream or CipherInputStream with a Cipher and your FileInputStream / FileOutputStream.
0 Comments
Leave a Reply. |