Code example for BigInteger

Methods: bitLength

0
     
    @Override 
	public byte[] asBytes() { 
        return Util.MPIbytes(x);
    } 
     
    @Override 
	public byte[] fingerprint() { 
        return fingerprint(new BigInteger[] {x});
    } 
 
	public SimpleFieldSet asFieldSet() { 
		SimpleFieldSet fs = new SimpleFieldSet(true);
		fs.putSingle("x", Base64.encode(x.toByteArray()));
		return fs;
	} 
 
	public static DSAPrivateKey create(SimpleFieldSet fs, DSAGroup group) throws IllegalBase64Exception {
		NativeBigInteger y = new NativeBigInteger(1, Base64.decode(fs.get("x")));
		if(y.bitLength() > 512)
			throw new IllegalBase64Exception("Probably a pubkey");