Package org.bouncycastle.crypto.generators

Examples of org.bouncycastle.crypto.generators.ECKeyPairGenerator


        }

        if (state == Cipher.ENCRYPT_MODE || state == Cipher.WRAP_MODE)
        {
            // Generate the ephemeral key pair
            ECKeyPairGenerator gen = new ECKeyPairGenerator();
            gen.init(new ECKeyGenerationParameters(ecParams, random));

            EphemeralKeyPairGenerator kGen = new EphemeralKeyPairGenerator(gen, new KeyEncoder()
            {
                public byte[] getEncoded(AsymmetricKeyParameter keyParameter)
                {
View Full Code Here


    }

    public static AsymmetricCipherKeyPair generateECKeyPair(SecureRandom random, ECDomainParameters ecParams)
    {

        ECKeyPairGenerator keyPairGenerator = new ECKeyPairGenerator();
        ECKeyGenerationParameters keyGenerationParameters = new ECKeyGenerationParameters(ecParams, random);
        keyPairGenerator.init(keyGenerationParameters);
        return keyPairGenerator.generateKeyPair();
    }
View Full Code Here

        AsymmetricCipherKeyPair tempPair;
        do // generate r
        {
            // generate another, but very temporary, key pair using
            // the same EC parameters
            ECKeyPairGenerator keyGen = new ECKeyPairGenerator();
           
            keyGen.init(new ECKeyGenerationParameters(privKey.getParameters(), this.random));
           
            tempPair = keyGen.generateKeyPair();

            //    BigInteger Vx = tempPair.getPublic().getW().getAffineX();
            ECPublicKeyParameters V = (ECPublicKeyParameters)tempPair.getPublic();        // get temp's public key
            BigInteger Vx = V.getQ().getX().toBigInteger();        // get the point's x coordinate
           
View Full Code Here

        AsymmetricCipherKeyPair tempPair;
        do // generate r
        {
            // generate another, but very temporary, key pair using
            // the same EC parameters
            ECKeyPairGenerator keyGen = new ECKeyPairGenerator();
           
            keyGen.init(new ECKeyGenerationParameters(privKey.getParameters(), this.random));
           
            tempPair = keyGen.generateKeyPair();

            //    BigInteger Vx = tempPair.getPublic().getW().getAffineX();
            ECPublicKeyParameters V = (ECPublicKeyParameters)tempPair.getPublic();        // get temp's public key
            BigInteger Vx = V.getQ().getX().toBigInteger();        // get the point's x coordinate
           
View Full Code Here

        AsymmetricCipherKeyPair tempPair;
        do // generate r
        {
            // generate another, but very temporary, key pair using
            // the same EC parameters
            ECKeyPairGenerator keyGen = new ECKeyPairGenerator();
           
            keyGen.init(new ECKeyGenerationParameters(privKey.getParameters(), this.random));
           
            tempPair = keyGen.generateKeyPair();

            //    BigInteger Vx = tempPair.getPublic().getW().getAffineX();
            ECPublicKeyParameters V = (ECPublicKeyParameters)tempPair.getPublic();        // get temp's public key
            BigInteger Vx = V.getQ().getX().toBigInteger();        // get the point's x coordinate
           
View Full Code Here

                curve,
                curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G
                new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n


            ECKeyPairGenerator          pGen = new ECKeyPairGenerator();
            ECKeyGenerationParameters   genParam = new ECKeyGenerationParameters(
                                            params,
                                            random);

            pGen.init(genParam);

            AsymmetricCipherKeyPair  pair = pGen.generateKeyPair();
       
            ParametersWithRandom param = new ParametersWithRandom(pair.getPrivate(), random);

            ECDSASigner ecdsa = new ECDSASigner();
View Full Code Here

            curve,
            curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G
            new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n


        ECKeyPairGenerator          pGen = new ECKeyPairGenerator();
        ECKeyGenerationParameters   genParam = new ECKeyGenerationParameters(
                                        params,
                                        random);

        pGen.init(genParam);

        AsymmetricCipherKeyPair  p1 = pGen.generateKeyPair();
        AsymmetricCipherKeyPair  p2 = pGen.generateKeyPair();
   
        //
        // stream test
        //
        IESEngine      i1 = new IESEngine(
View Full Code Here

                curve,
                curve.decodePoint(Hex.decode("020ffa963cdca8816ccc33b8642bedf905c3d358573d3f27fbbd3b3cb9aaaf")), // G
                new BigInteger("883423532389192164791648750360308884807550341691627752275345424702807307")); // n


            ECKeyPairGenerator          pGen = new ECKeyPairGenerator();
            ECKeyGenerationParameters   genParam = new ECKeyGenerationParameters(
                                            params,
                                            random);

            pGen.init(genParam);

            AsymmetricCipherKeyPair  p1 = pGen.generateKeyPair();
            AsymmetricCipherKeyPair  p2 = pGen.generateKeyPair();
       
            //
            // two way
            //
            BasicAgreement    e1 = new ECDHBasicAgreement();
View Full Code Here

    return c;
  }

  public static ECKeyPair createNew (boolean compressed)
  {
    ECKeyPairGenerator generator = new ECKeyPairGenerator ();
    ECKeyGenerationParameters keygenParams = new ECKeyGenerationParameters (domain, secureRandom);
    generator.init (keygenParams);
    AsymmetricCipherKeyPair keypair = generator.generateKeyPair ();
    ECPrivateKeyParameters privParams = (ECPrivateKeyParameters) keypair.getPrivate ();
    ECPublicKeyParameters pubParams = (ECPublicKeyParameters) keypair.getPublic ();
    ECKeyPair k = new ECKeyPair ();
    k.priv = privParams.getD ();
    k.compressed = compressed;
View Full Code Here

        AsymmetricCipherKeyPair tempPair;
        do // generate r
        {
            // generate another, but very temporary, key pair using
            // the same EC parameters
            ECKeyPairGenerator keyGen = new ECKeyPairGenerator();
           
            keyGen.init(new ECKeyGenerationParameters(privKey.getParameters(), this.random));
           
            tempPair = keyGen.generateKeyPair();

            //    BigInteger Vx = tempPair.getPublic().getW().getAffineX();
            ECPublicKeyParameters V = (ECPublicKeyParameters)tempPair.getPublic();        // get temp's public key
            BigInteger Vx = V.getQ().getX().toBigInteger();        // get the point's x coordinate
           
View Full Code Here

TOP

Related Classes of org.bouncycastle.crypto.generators.ECKeyPairGenerator

Copyright © 2018 www.massapicom. 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.