Code example for PBEParameterSpec

0
 
    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 
  public String encrypt(String plainStr)
    throws Exception 
  { 
    if (plainStr == null) {
      throw new IllegalArgumentException("The argument 'plainStr' is null");
    } 
 
    byte[] utf8 = plainStr.getBytes("UTF8");