PBE key spec : Key « Security « Java Tutorial






import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;

public class MainClass {

  public static void main(String[] args) throws Exception {
    PBEKeySpec keySpec = new PBEKeySpec("charArray".toCharArray());
    SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
    SecretKey key = keyFactory.generateSecret(keySpec);
    System.out.println(new String(key.getEncoded()));
  }
}








36.20.Key
36.20.1.DES Key Agreement
36.20.2.PBE key spec
36.20.3.Key Agreement
36.20.4.Use DSAKey
36.20.5.Rich DES Key
36.20.6.implements Key, PublicKey, PrivateKey