Example usage for org.bouncycastle.crypto.agreement.srp SRP6Client SRP6Client

List of usage examples for org.bouncycastle.crypto.agreement.srp SRP6Client SRP6Client

Introduction

In this page you can find the example usage for org.bouncycastle.crypto.agreement.srp SRP6Client SRP6Client.

Prototype

public SRP6Client() 

Source Link

Usage

From source file:org.drombler.commons.security.auth.message.module.srp.client.SRPClientAuthModule.java

License:CDDL license

@Override
public void initialize(MessagePolicy requestPolicy, MessagePolicy responsePolicy, CallbackHandler handler,
        Map options) throws AuthException {
    SRP6Client srpClient = new SRP6Client();
    throw new UnsupportedOperationException("Not supported yet.");
}

From source file:org.forgerock.openicf.framework.remote.SecurityUtil.java

License:CDDL license

/**
 * Verifies the client and server secret.
 *
 * @param username     user name (aka "identity")
 * @param password     password/*from  w  w w. j  av  a2s  .  co m*/
 * @param verification
 * @param random       the source of randomness for this generator
 * @param params       group parameters (prime, generator)
 * @return true if client and server secret is equals
 * @throws CryptoException If client or server's credentials are invalid
 */
public static boolean checkMutualVerification(String username, String password,
        Pair<String, byte[]> verification, SecureRandom random, SRPGroupParameter params)
        throws CryptoException {

    byte[] I = username.getBytes();
    byte[] P = password.getBytes();
    byte[] s = verification.second;
    BigInteger v = new BigInteger(verification.first, 16);

    SRP6Client client = new SRP6Client();
    client.init(params.N, params.g, new SHA256Digest(), random);

    SRP6Server server = new SRP6Server();
    server.init(params.N, params.g, v, new SHA256Digest(), random);

    BigInteger A = client.generateClientCredentials(s, I, P);
    BigInteger B = server.generateServerCredentials();

    BigInteger clientS = client.calculateSecret(B);
    BigInteger serverS = server.calculateSecret(A);

    return clientS.equals(serverS);
}