@Override
	public final Key keyFromPassword(char[] password) {
		try {
			SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256");
			int keyLength = Math.min(Cipher.getMaxAllowedKeyLength(algorithm), maximumKeyLength);
			KeySpec spec = new PBEKeySpec(password, salt, iterationCount, keyLength);
			SecretKey tmp = factory.generateSecret(spec);
			return new SecretKeySpec(tmp.getEncoded(), algorithm);
		} catch (NoSuchAlgorithmException e) {
			throw new RuntimeException(e);
		} catch (InvalidKeySpecException e) {
			throw new RuntimeException(e);
		}
	}
@ Override public final Key keyFromPassword ( char [ ] password ) { try { SecretKeyFactory factory = SecretKeyFactory . getInstance ( "PBKDF2WithHmacSHA256" ) ; int keyLength = Math . min ( Cipher . getMaxAllowedKeyLength ( algorithm ) , maximumKeyLength ) ; KeySpec spec = new PBEKeySpec ( password , salt , iterationCount , keyLength ) ; SecretKey tmp = factory . generateSecret ( spec ) ; return new SecretKeySpec ( tmp . getEncoded ( ) , algorithm ) ; } catch ( NoSuchAlgorithmException e ) { throw new RuntimeException ( e ) ; } catch ( InvalidKeySpecException e ) { throw new RuntimeException ( e ) ; } }
/*
Interface implementations