Code example for InvalidParameterSpecException

0
        AlgorithmParameterSpec paramSpec)
        throws InvalidParameterSpecException 
    { 
        if (!(paramSpec instanceof DSAParameterSpec))
        { 
            throw new InvalidParameterSpecException("DSAParameterSpec required to initialise a DSA algorithm parameters object");
        } 
 
        this.currentSpec = (DSAParameterSpec)paramSpec;
    } 
 
    protected void engineInit( 
        byte[] params)
        throws IOException 
    { 
        try 
        { 
            DSAParameter dsaP = DSAParameter.getInstance(ASN1Primitive.fromByteArray(params));
 
            currentSpec = new DSAParameterSpec(dsaP.getP(), dsaP.getQ(), dsaP.getG());
        }