()
| 92 | } |
| 93 | |
| 94 | private static byte[] generateSalt() { |
| 95 | byte[] salt = new byte[SALT_LENGTH]; |
| 96 | new SecureRandom().nextBytes(salt); |
| 97 | return salt; |
| 98 | } |
| 99 | |
| 100 | private static SecretKey deriveKey(char[] masterPassword, byte[] salt) throws Exception { |
| 101 | KeySpec spec = new PBEKeySpec(masterPassword, salt, ITERATIONS, KEY_LENGTH); |