Java 类org.bouncycastle.crypto.params.SRP6GroupParameters 实例源码

项目:gwt-crypto    文件:SimulatedTlsSRPIdentityManager.java   
/**
 * Create a {@link SimulatedTlsSRPIdentityManager} that implements the algorithm from RFC 5054 2.5.1.3
 *
 * @param group the {@link SRP6GroupParameters} defining the group that SRP is operating in
 * @param seedKey the secret "seed key" referred to in RFC 5054 2.5.1.3
 * @return an instance of {@link SimulatedTlsSRPIdentityManager}
 */
public static SimulatedTlsSRPIdentityManager getRFC5054Default(SRP6GroupParameters group, byte[] seedKey)
{
    SRP6VerifierGenerator verifierGenerator = new SRP6VerifierGenerator();
    verifierGenerator.init(group, TlsUtils.createHash(HashAlgorithm.sha1));

    HMac mac = new HMac(TlsUtils.createHash(HashAlgorithm.sha1));
    mac.init(new KeyParameter(seedKey));

    return new SimulatedTlsSRPIdentityManager(group, verifierGenerator, mac);
}
项目:gwt-crypto    文件:DefaultTlsSRPGroupVerifier.java   
public boolean accept(SRP6GroupParameters group)
{
    for (int i = 0; i < groups.size(); ++i)
    {
        if (areGroupsEqual(group, (SRP6GroupParameters)groups.elementAt(i)))
        {
            return true;
        }
    }
    return false;
}
项目:gwt-crypto    文件:SRP6Test.java   
private void testWithRandomParams(int bits) throws CryptoException
{
    DHParametersGenerator paramGen = new DHParametersGenerator();
    paramGen.init(bits, 25, random);
    DHParameters parameters = paramGen.generateParameters();

    testMutualVerification(new SRP6GroupParameters(parameters.getP(), parameters.getG()));
}
项目:Aki-SSL    文件:SimulatedTlsSRPIdentityManager.java   
/**
 * Create a {@link SimulatedTlsSRPIdentityManager} that implements the algorithm from RFC 5054 2.5.1.3
 *
 * @param group the {@link SRP6GroupParameters} defining the group that SRP is operating in
 * @param seedKey the secret "seed key" referred to in RFC 5054 2.5.1.3
 * @return an instance of {@link SimulatedTlsSRPIdentityManager}
 */
public static SimulatedTlsSRPIdentityManager getRFC5054Default(SRP6GroupParameters group, byte[] seedKey)
{
    SRP6VerifierGenerator verifierGenerator = new SRP6VerifierGenerator();
    verifierGenerator.init(group, TlsUtils.createHash(HashAlgorithm.sha1));

    HMac mac = new HMac(TlsUtils.createHash(HashAlgorithm.sha1));
    mac.init(new KeyParameter(seedKey));

    return new SimulatedTlsSRPIdentityManager(group, verifierGenerator, mac);
}
项目:Aki-SSL    文件:DefaultTlsSRPGroupVerifier.java   
public boolean accept(SRP6GroupParameters group)
{
    for (int i = 0; i < groups.size(); ++i)
    {
        if (areGroupsEqual(group, (SRP6GroupParameters)groups.elementAt(i)))
        {
            return true;
        }
    }
    return false;
}
项目:TinyTravelTracker    文件:SimulatedTlsSRPIdentityManager.java   
/**
 * Create a {@link SimulatedTlsSRPIdentityManager} that implements the algorithm from RFC 5054 2.5.1.3
 *
 * @param group the {@link SRP6GroupParameters} defining the group that SRP is operating in
 * @param seedKey the secret "seed key" referred to in RFC 5054 2.5.1.3
 * @return an instance of {@link SimulatedTlsSRPIdentityManager}
 */
public static SimulatedTlsSRPIdentityManager getRFC5054Default(SRP6GroupParameters group, byte[] seedKey)
{
    SRP6VerifierGenerator verifierGenerator = new SRP6VerifierGenerator();
    verifierGenerator.init(group, TlsUtils.createHash(HashAlgorithm.sha1));

    HMac mac = new HMac(TlsUtils.createHash(HashAlgorithm.sha1));
    mac.init(new KeyParameter(seedKey));

    return new SimulatedTlsSRPIdentityManager(group, verifierGenerator, mac);
}
项目:TinyTravelTracker    文件:DefaultTlsSRPGroupVerifier.java   
public boolean accept(SRP6GroupParameters group)
{
    for (int i = 0; i < groups.size(); ++i)
    {
        if (areGroupsEqual(group, (SRP6GroupParameters)groups.elementAt(i)))
        {
            return true;
        }
    }
    return false;
}
项目:gwt-crypto    文件:SimulatedTlsSRPIdentityManager.java   
public SimulatedTlsSRPIdentityManager(SRP6GroupParameters group, SRP6VerifierGenerator verifierGenerator, Mac mac)
{
    this.group = group;
    this.verifierGenerator = verifierGenerator;
    this.mac = mac;
}
项目:gwt-crypto    文件:DefaultTlsSRPGroupVerifier.java   
protected boolean areGroupsEqual(SRP6GroupParameters a, SRP6GroupParameters b)
{
    return a == b || (areParametersEqual(a.getN(), b.getN()) && areParametersEqual(a.getG(), b.getG()));
}
项目:gwt-crypto    文件:TlsSRPLoginParameters.java   
public TlsSRPLoginParameters(SRP6GroupParameters group, BigInteger verifier, byte[] salt)
{
    this.group = group;
    this.verifier = verifier;
    this.salt = salt;
}
项目:gwt-crypto    文件:TlsSRPLoginParameters.java   
public SRP6GroupParameters getGroup()
{
    return group;
}
项目:gwt-crypto    文件:SRP6Server.java   
public void init(SRP6GroupParameters group, BigInteger v, Digest digest, SecureRandom random)
{
    init(group.getN(), group.getG(), v, digest, random);
}
项目:gwt-crypto    文件:SRP6VerifierGenerator.java   
public void init(SRP6GroupParameters group, Digest digest)
{
    this.N = group.getN();
    this.g = group.getG();
    this.digest = digest;
}
项目:gwt-crypto    文件:SRP6StandardGroups.java   
private static SRP6GroupParameters fromNG(String hexN, String hexG)
{
    return new SRP6GroupParameters(fromHex(hexN), fromHex(hexG));
}
项目:gwt-crypto    文件:SRP6Client.java   
public void init(SRP6GroupParameters group, Digest digest, SecureRandom random)
{
    init(group.getN(), group.getG(), digest, random);
}
项目:gwt-crypto    文件:SRP6Test.java   
private void testMutualVerification(SRP6GroupParameters group) throws CryptoException
{
    byte[] I = "username".getBytes();
    byte[] P = "password".getBytes();
    byte[] s = new byte[16];
    random.nextBytes(s);

    SRP6VerifierGenerator gen = new SRP6VerifierGenerator();
    gen.init(group, new SHA256Digest());
    BigInteger v = gen.generateVerifier(s, I, P);

    SRP6Client client = new SRP6Client();
    client.init(group, new SHA256Digest(), random);

    SRP6Server server = new SRP6Server();
    server.init(group, 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);

    if (!clientS.equals(serverS))
    {
        fail("SRP agreement failed - client/server calculated different secrets");
    }
}
项目:Aki-SSL    文件:SimulatedTlsSRPIdentityManager.java   
public SimulatedTlsSRPIdentityManager(SRP6GroupParameters group, SRP6VerifierGenerator verifierGenerator, Mac mac)
{
    this.group = group;
    this.verifierGenerator = verifierGenerator;
    this.mac = mac;
}
项目:Aki-SSL    文件:DefaultTlsSRPGroupVerifier.java   
protected boolean areGroupsEqual(SRP6GroupParameters a, SRP6GroupParameters b)
{
    return a == b || (areParametersEqual(a.getN(), b.getN()) && areParametersEqual(a.getG(), b.getG()));
}
项目:Aki-SSL    文件:TlsSRPLoginParameters.java   
public TlsSRPLoginParameters(SRP6GroupParameters group, BigInteger verifier, byte[] salt)
{
    this.group = group;
    this.verifier = verifier;
    this.salt = salt;
}
项目:Aki-SSL    文件:TlsSRPLoginParameters.java   
public SRP6GroupParameters getGroup()
{
    return group;
}
项目:Aki-SSL    文件:SRP6Server.java   
public void init(SRP6GroupParameters group, BigInteger v, Digest digest, SecureRandom random)
{
    init(group.getN(), group.getG(), v, digest, random);
}
项目:Aki-SSL    文件:SRP6VerifierGenerator.java   
public void init(SRP6GroupParameters group, Digest digest)
{
    this.N = group.getN();
    this.g = group.getG();
    this.digest = digest;
}
项目:Aki-SSL    文件:SRP6StandardGroups.java   
private static SRP6GroupParameters fromNG(String hexN, String hexG)
{
    return new SRP6GroupParameters(fromHex(hexN), fromHex(hexG));
}
项目:Aki-SSL    文件:SRP6Client.java   
public void init(SRP6GroupParameters group, Digest digest, SecureRandom random)
{
    init(group.getN(), group.getG(), digest, random);
}
项目:TinyTravelTracker    文件:SimulatedTlsSRPIdentityManager.java   
public SimulatedTlsSRPIdentityManager(SRP6GroupParameters group, SRP6VerifierGenerator verifierGenerator, Mac mac)
{
    this.group = group;
    this.verifierGenerator = verifierGenerator;
    this.mac = mac;
}
项目:TinyTravelTracker    文件:DefaultTlsSRPGroupVerifier.java   
protected boolean areGroupsEqual(SRP6GroupParameters a, SRP6GroupParameters b)
{
    return a == b || (areParametersEqual(a.getN(), b.getN()) && areParametersEqual(a.getG(), b.getG()));
}
项目:TinyTravelTracker    文件:TlsSRPLoginParameters.java   
public TlsSRPLoginParameters(SRP6GroupParameters group, BigInteger verifier, byte[] salt)
{
    this.group = group;
    this.verifier = verifier;
    this.salt = salt;
}
项目:TinyTravelTracker    文件:TlsSRPLoginParameters.java   
public SRP6GroupParameters getGroup()
{
    return group;
}
项目:TinyTravelTracker    文件:SRP6Server.java   
public void init(SRP6GroupParameters group, BigInteger v, Digest digest, SecureRandom random)
{
    init(group.getN(), group.getG(), v, digest, random);
}
项目:TinyTravelTracker    文件:SRP6VerifierGenerator.java   
public void init(SRP6GroupParameters group, Digest digest)
{
    this.N = group.getN();
    this.g = group.getG();
    this.digest = digest;
}
项目:TinyTravelTracker    文件:SRP6StandardGroups.java   
private static SRP6GroupParameters fromNG(String hexN, String hexG)
{
    return new SRP6GroupParameters(fromHex(hexN), fromHex(hexG));
}
项目:TinyTravelTracker    文件:SRP6Client.java   
public void init(SRP6GroupParameters group, Digest digest, SecureRandom random)
{
    init(group.getN(), group.getG(), digest, random);
}
项目:JavaWoW    文件:WoWSRP6Server.java   
public static final WoWSRP6Server init(SRP6GroupParameters params, BigInteger v, byte[] I, byte[] s, Digest digest, SecureRandom random) {
    WoWSRP6Server srp = new WoWSRP6Server();
    srp.initInternal(params, v, I, s, digest, random);
    return srp;
}
项目:JavaWoW    文件:WoWSRP6Server.java   
private final void initInternal(SRP6GroupParameters params, BigInteger v, byte[] I, byte[] s, Digest digest, SecureRandom random) {
    this.I = I.clone();
    this.s = s.clone();
    super.init(params.getN(), params.getG(), v, digest, random);
}
项目:JavaWoW    文件:WoWSRP6Server.java   
@Override
public final void init(SRP6GroupParameters params, BigInteger v, Digest digest, SecureRandom random) {
    throw new UnsupportedOperationException();
}
项目:gwt-crypto    文件:TlsSRPGroupVerifier.java   
/**
 * Check whether the given SRP group parameters are acceptable for use.
 * 
 * @param group the {@link SRP6GroupParameters} to check
 * @return true if (and only if) the specified group parameters are acceptable
 */
boolean accept(SRP6GroupParameters group);
项目:Aki-SSL    文件:TlsSRPGroupVerifier.java   
/**
 * Check whether the given SRP group parameters are acceptable for use.
 * 
 * @param group the {@link SRP6GroupParameters} to check
 * @return true if (and only if) the specified group parameters are acceptable
 */
boolean accept(SRP6GroupParameters group);
项目:TinyTravelTracker    文件:TlsSRPGroupVerifier.java   
/**
 * Check whether the given SRP group parameters are acceptable for use.
 * 
 * @param group the {@link SRP6GroupParameters} to check
 * @return true if (and only if) the specified group parameters are acceptable
 */
boolean accept(SRP6GroupParameters group);