public static PBEKeySpec getPBEKey()
{
String password =
"This is my first password cryptograph program.";
return new PBEKeySpec(password.toCharArray());
}
public static byte[] getSalt()
throws IOException,
ClassNotFoundException
{
File saltFile = new File(getSaltFileName());
if (saltFile.exists())
return loadSalt(getSaltFileName());
Random random = new Random();
byte[] salt = new byte[8];
random.nextBytes(salt);
saveSalt(salt, getSaltFileName());
return salt;
}