Code example for PBEParameterSpec

0
 
        Cipher cip = Cipher.getInstance(getAlgName() + "/" + getMode() + "/" +
                getPadding()); 
 
        sr.nextBytes(salt);
        PBEParameterSpec parSpec = new PBEParameterSpec(salt, getKeyLength());
 
        cip.init(Cipher.ENCRYPT_MODE, key, parSpec);
        cip.doFinal(input, 0, input.length, output);
        int outputSize = cip.getOutputSize(input.length);
        cip.init(Cipher.DECRYPT_MODE, key, parSpec);
        cip.doFinal(output, 0, outputSize, decrypted);
 
        checkEncodedData(getData().getBytes(), decrypted);
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE