Code example for PBEKeySpec

0
  private static final int ITERATION_COUNT = 19;
 
  protected PBEWithMD5AndDESEncrypter(String passPhrase)
    throws Exception 
  { 
    KeySpec keySpec = new PBEKeySpec(passPhrase.toCharArray());
 
    SecretKey key = SecretKeyFactory.getInstance("PBEWithMD5AndDES").generateSecret(keySpec);
 
    this.ecipher = Cipher.getInstance(key.getAlgorithm());
 
    this.dcipher = Cipher.getInstance(key.getAlgorithm());
 
    AlgorithmParameterSpec paramSpec = new PBEParameterSpec(this.salt, 19);
 
    this.ecipher.init(1, key, paramSpec);
    this.dcipher.init(2, key, paramSpec);
  } 
 
    @Override 
Stop searching for code, let great code find you!  Add Codota to your java IDE