Package org.bouncycastle.crypto.params

Examples of org.bouncycastle.crypto.params.DHParameters


            }

            break;
        }

        return new DHParameters(p, g, q, 2);
    }
View Full Code Here


    private TestResult testGP(
        int         size,
        BigInteger  g,
        BigInteger  p)
    {
        DHParameters                dhParams = new DHParameters(p, g);

        DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);

        DHKeyPairGenerator          kpGen = new DHKeyPairGenerator();
View Full Code Here

    private TestResult testSimple(
        int         size,
        BigInteger  g,
        BigInteger  p)
    {
        DHParameters                dhParams = new DHParameters(p, g);

        DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);

        DHBasicKeyPairGenerator     kpGen = new DHBasicKeyPairGenerator();
View Full Code Here

    {
        DHParametersGenerator       pGen = new DHParametersGenerator();

        pGen.init(size, 10, new SecureRandom());

        DHParameters                dhParams = pGen.generateParameters();

        DHKeyGenerationParameters   params = new DHKeyGenerationParameters(new SecureRandom(), dhParams);

        DHBasicKeyPairGenerator     kpGen = new DHBasicKeyPairGenerator();
View Full Code Here

  private void setP(BigInteger p){this.p=p;}
  private void setG(BigInteger g){this.g=g;}
  private void setF(BigInteger f){this.f=f;}
  private DHParameters getParameter(){
    if(param==null){
      param=new DHParameters(p, g);
    }
    return param;
  }
View Full Code Here

         }

         /*
          * Diffie-Hellman basic key agreement
          */
         DHParameters dhParams = new DHParameters(p, g);

         // Generate a keypair
         DHBasicKeyPairGenerator dhGen = new DHBasicKeyPairGenerator();
         dhGen.init(new DHKeyGenerationParameters(random, dhParams));

View Full Code Here

    public AsymmetricCipherKeyPair generateKeyPair()
    {
        BigInteger      p, g, x, y;
        int             qLength = param.getStrength() - 1;
        DHParameters    dhParams = param.getParameters();

        p = dhParams.getP();
        g = dhParams.getG();
   
        //
        // calculate the private key
        //
        x = new BigInteger(qLength, param.getRandom());
View Full Code Here

    public AsymmetricCipherKeyPair generateKeyPair()
    {
        BigInteger      p, g, x, y;
        int             qLength = param.getStrength() - 1;
        DHParameters    dhParams = param.getParameters();

        p = dhParams.getP();
        g = dhParams.getG();
  
        //
        // calculate the private key
        //
        x = new BigInteger(qLength, param.getRandom());
View Full Code Here

            }

            break;
        }

        return new DHParameters(p, g, q, 2);
    }
View Full Code Here

        if (key instanceof DHPublicKey)
        {
            DHPublicKey    k = (DHPublicKey)key;

            return new DHPublicKeyParameters(k.getY(),
                new DHParameters(k.getParams().getP(), k.getParams().getG(), null, k.getParams().getL()));
        }

        throw new InvalidKeyException("can't identify DH public key.");
    }
View Full Code Here

TOP

Related Classes of org.bouncycastle.crypto.params.DHParameters

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.