Examples of SRPKeyPairGenerator


Examples of gnu.javax.crypto.key.srp6.SRPKeyPairGenerator

        String[] mpi = tpasswd.lookupConfig(entry[2]);
        BigInteger N = new BigInteger(1, Util.fromBase64(mpi[0]));
        BigInteger g = new BigInteger(1, Util.fromBase64(mpi[1]));

        IKeyPairGenerator kpg = new SRPKeyPairGenerator();
        HashMap attributes = new HashMap();
        attributes.put(SRPKeyPairGenerator.SHARED_MODULUS, N);
        attributes.put(SRPKeyPairGenerator.GENERATOR, g);
        kpg.setup(attributes);

        KeyPair clientKP = kpg.generate();
        BigInteger A = ((SRPPublicKey) clientKP.getPublic()).getY();
        BigInteger a = ((SRPPrivateKey) clientKP.getPrivate()).getX();

        attributes.put(SRPKeyPairGenerator.USER_VERIFIER, v);
        kpg.setup(attributes);

        KeyPair serverKP = kpg.generate();
        BigInteger B = ((SRPPublicKey) serverKP.getPublic()).getY();
        BigInteger b = ((SRPPrivateKey) serverKP.getPrivate()).getX();

        // compute u = H(A | B)
        IMessageDigest hash = srp.newDigest();
View Full Code Here

Examples of gnu.javax.crypto.key.srp6.SRPKeyPairGenerator

    final String[] mpi = tpasswd.lookupConfig(entry[2]);
    final BigInteger N = new BigInteger(1, Util.fromBase64(mpi[0]));
    final BigInteger g = new BigInteger(1, Util.fromBase64(mpi[1]));

    final IKeyPairGenerator kpg = new SRPKeyPairGenerator();
    final HashMap attributes = new HashMap();
    attributes.put(SRPKeyPairGenerator.SHARED_MODULUS, N);
    attributes.put(SRPKeyPairGenerator.GENERATOR, g);
    kpg.setup(attributes);

    final KeyPair clientKP = kpg.generate();
    final BigInteger A = ((SRPPublicKey) clientKP.getPublic()).getY();
    final BigInteger a = ((SRPPrivateKey) clientKP.getPrivate()).getX();

    attributes.put(SRPKeyPairGenerator.USER_VERIFIER, v);
    kpg.setup(attributes);

    final KeyPair serverKP = kpg.generate();
    final BigInteger B = ((SRPPublicKey) serverKP.getPublic()).getY();
    final BigInteger b = ((SRPPrivateKey) serverKP.getPrivate()).getX();

    // compute u = H(A | B)
    //      IMessageDigest hash = srp.newDigest();
View Full Code Here

Examples of gnu.javax.crypto.key.srp6.SRPKeyPairGenerator

public class TestOfSRPKeyGeneration implements Testlet
{
  public void test(TestHarness harness)
  {
    harness.checkPoint("TestOfSRPKeyGeneration");
    SRPKeyPairGenerator kpg = new SRPKeyPairGenerator();
    HashMap map = new HashMap();
    map.put(SRPKeyPairGenerator.MODULUS_LENGTH, new Integer(530));

    try
      {
        kpg.setup(map);
        harness.fail("L should be >= 512, <= 2048 and of the form 512 + 256n");
      }
    catch (IllegalArgumentException x)
      {
        harness.check(true,
                      "L should be >= 512, <= 2048 and of the form 512 + 256n");
      }

    map.put(SRPKeyPairGenerator.MODULUS_LENGTH, new Integer(512));
    map.put(SRPKeyPairGenerator.USE_DEFAULTS, Boolean.FALSE);
    kpg.setup(map);
    KeyPair kp = kpg.generate();

    BigInteger N1 = ((SRPPublicKey) kp.getPublic()).getN();
    BigInteger N2 = ((SRPPrivateKey) kp.getPrivate()).getN();
    harness.check(N1.equals(N2), "N1.equals(N2)");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.