code: public static SecretKey newSecretKey(final char[] password, final String algorithm)
  		throws NoSuchAlgorithmException, InvalidKeySpecException
  	{
  		final PBEKeySpec pbeKeySpec = new PBEKeySpec(password);
  		final SecretKeyFactory secretKeyFactory = SecretKeyFactory.getInstance(algorithm);
  		final SecretKey secretKey = secretKeyFactory.generateSecret(pbeKeySpec);
  		return secretKey;
  	}
docs: Factory method for creating a new {@link SecretKey} from the given password and algorithm.
  
  @param password
  the password
  @param algorithm
  the algorithm
  @return the new {@link SecretKey} from the given password and algorithm.
  @throws NoSuchAlgorithmException
  is thrown if instantiation of the SecretKeyFactory object fails.
  @throws InvalidKeySpecException
  is thrown if generation of the SecretKey object fails.