Here you can find the source of generatePBEKey(char[] password, byte[] salt, String algorthm, int iterations, int keyLength)
private static SecretKey generatePBEKey(char[] password, byte[] salt, String algorthm, int iterations, int keyLength) throws NoSuchAlgorithmException, InvalidKeySpecException
//package com.java2s; import java.security.NoSuchAlgorithmException; import java.security.spec.InvalidKeySpecException; import java.security.spec.KeySpec; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.PBEKeySpec; public class Main { private static SecretKey generatePBEKey(char[] password, byte[] salt, String algorthm, int iterations, int keyLength) throws NoSuchAlgorithmException, InvalidKeySpecException { SecretKeyFactory secretKeyFactory = SecretKeyFactory .getInstance(algorthm);/* ww w . j a va2s.com*/ KeySpec keySpec = new PBEKeySpec(password, salt, iterations, keyLength); SecretKey secretKey = secretKeyFactory.generateSecret(keySpec); return secretKey; } }