Code example for BigInteger

Methods: mod, modPow

0
     * @return A shared secret BigInteger 
     * @throws CryptoException If client's credentials are invalid 
     */ 
    public BigInteger calculateSecret(BigInteger clientA) throws CryptoException
    { 
        this.A = SRP6Util.validatePublicValue(N, clientA);
        this.u = SRP6Util.calculateU(digest, N, A, B);
        this.S = calculateS();
 
        return S;
    } 
 
    protected BigInteger selectPrivateValue()
    { 
        return SRP6Util.generatePrivateValue(digest, N, g, random);        
    } 
 
    private BigInteger calculateS()
    { 
        return v.modPow(u, N).multiply(A).mod(N).modPow(b, N);
    } 
}