Code example for PBEParameterSpec

0
   */ 
  public DefaultCryptor() 
    throws NoSuchAlgorithmException,InvalidKeySpecException 
  { 
    // Create PBE parameter set 
    pbeParamSpec = new PBEParameterSpec(salt,count);
    pbeKeySpec = new PBEKeySpec("saagar".toCharArray());
    keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
    pbeKey = keyFac.generateSecret(pbeKeySpec);
  } 
 
  /** 
   * Encrypt the string 
   */ 
  private byte[] crypt(int cipherMode,byte[] text)
    throws  NoSuchPaddingException, 
            NoSuchAlgorithmException, 
            InvalidAlgorithmParameterException, 
            InvalidKeyException, 
            IllegalBlockSizeException, 
            BadPaddingException