Java 256-bit AES Password-Based Encryption

Share the password (a char[]) and salt (a byte[]—8 bytes selected by a SecureRandom makes a good salt—which doesn’t need to be kept secret) with the recipient out-of-band. Then to derive a good key from this information: /* Derive the key, given password and salt. */ SecretKeyFactory factory = SecretKeyFactory.getInstance(“PBKDF2WithHmacSHA256”); KeySpec spec = new PBEKeySpec(password, … Read more

C Password Log giving me errors

\u is a special code in printf; your code contains \username which is causing the error you are getting. I suspect you just have a typo there; if not, represent a backslash in printf with \\. Per @Jim Balter’s comment, you probably used \ where you meant /.