Code example for InvalidParameterSpecException

0
            AlgorithmParameterSpec paramSpec) 
            throws InvalidParameterSpecException 
        { 
            if (!(paramSpec instanceof DHParameterSpec))
            { 
                throw new InvalidParameterSpecException("DHParameterSpec required to initialise a Diffie-Hellman algorithm parameters object");
            } 
 
            this.currentSpec = (DHParameterSpec)paramSpec;
        } 
 
        protected void engineInit( 
            byte[] params) 
            throws IOException 
        { 
            try 
            { 
                DHParameter dhP = DHParameter.getInstance(params);
 
                if (dhP.getL() != null)
                {