Java examples for Security:Key
create PBE Key
//package com.java2s; import javax.crypto.*; import javax.crypto.spec.PBEKeySpec; import java.security.Key; public class Main { public static Key createPBEKey(char[] password, byte[] salt, int iterationCount, String algorithm, String provider) throws Exception { PBEKeySpec pbeSpec = new PBEKeySpec(password, salt, iterationCount); SecretKeyFactory keyFact = SecretKeyFactory.getInstance(algorithm, provider);/*from ww w. ja va2 s.com*/ Key sKey = keyFact.generateSecret(pbeSpec); return sKey; } }