Code example for InvalidParameterSpecException

0
            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(),
                                pbeSpec.getIterationCount());
        } 
 
        protected void engineInit( 
            byte[] params)
            throws IOException 
        { 
            this.params = PBKDF2Params.getInstance(ASN1Primitive.fromByteArray(params));
        }