Code example for BigInteger

Methods: bitLength, signum

0
        // checks described in DSA standard 
        n = p.bitLength();
        if (p.compareTo(BigInteger.valueOf(1)) != 1 || n < 512 || n > 1024 || (n & 077) != 0) {
            throw new InvalidKeyException("bad p");
        } 
        if (q.signum() != 1 && q.bitLength() != 160) {
            throw new InvalidKeyException("bad q");
        } 
        if (x.signum() != 1 || x.compareTo(q) != -1) {
            throw new InvalidKeyException("x <= 0 || x >= q");
        } 
 
        dsaKey = (DSAKey) privateKey;
 
        msgDigest.reset();
    } 
 
    /** 
     * Initializes this signature object with PublicKey object 
     * passed as argument to the method. 
     *