Code example for InvalidParameterSpecException

            AlgorithmParameterSpec paramSpec)
            throws InvalidParameterSpecException 
            if (!(paramSpec instanceof PBEParameterSpec))
                throw new InvalidParameterSpecException("PBEParameterSpec required to initialise a PKCS12 PBE parameters algorithm parameters object");
            PBEParameterSpec    pbeSpec = (PBEParameterSpec)paramSpec;
            this.params = new PBKDF2Params(pbeSpec.getSalt(),
        protected void engineInit( 
            byte[] params)
            throws IOException 
            this.params = PBKDF2Params.getInstance(ASN1Primitive.fromByteArray(params));
Stop searching for code, let great code find you!  Add Codota to your java IDE