Examples of ECPublicKeyParameters


Examples of org.bouncycastle.crypto.params.ECPublicKeyParameters

    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;
    k.pub = pubParams.getQ ().getEncoded (compressed);
    return k;
  }
View Full Code Here

Examples of org.bouncycastle.crypto.params.ECPublicKeyParameters

  {
    ASN1InputStream asn1 = new ASN1InputStream (signature);
    try
    {
      ECDSASigner signer = new ECDSASigner ();
      signer.init (false, new ECPublicKeyParameters (curve.getCurve ().decodePoint (pub), domain));

      DLSequence seq = (DLSequence) asn1.readObject ();
      BigInteger r = ((ASN1Integer) seq.getObjectAt (0)).getPositiveValue ();
      BigInteger s = ((ASN1Integer) seq.getObjectAt (1)).getPositiveValue ();
      return signer.verifySignature (hash, r, s);
View Full Code Here

Examples of org.bouncycastle.crypto.params.ECPublicKeyParameters

            byte[]          data = bits.getBytes();
            ASN1OctetString key = new DEROctetString(data);

            X9ECPoint       derQ = new X9ECPoint(dParams.getCurve(), key);
           
            return new ECPublicKeyParameters(derQ.getPoint(), dParams);
        }
        else
        {
            throw new RuntimeException("algorithm identifier in key not recognised");
        }
View Full Code Here

Examples of org.bouncycastle.crypto.params.ECPublicKeyParameters

            if (s == null)
            {
                s = ProviderUtil.getEcImplicitlyCa();

                return new ECPublicKeyParameters(
                            ((JCEECPublicKey)k).engineGetQ(),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN(), s.getH(), s.getSeed()));
            }
            else
            {
                return new ECPublicKeyParameters(
                            k.getQ(),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN(), s.getH(), s.getSeed()));
            }
        }
        else if (key instanceof java.security.interfaces.ECPublicKey)
        {
            java.security.interfaces.ECPublicKey pubKey = (java.security.interfaces.ECPublicKey)key;
            ECParameterSpec s = EC5Util.convertSpec(pubKey.getParams(), false);
            return new ECPublicKeyParameters(
                EC5Util.convertPoint(pubKey.getParams(), pubKey.getW(), false),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN(), s.getH(), s.getSeed()));
        }

        throw new InvalidKeyException("cannot identify EC public key.");
View Full Code Here

Examples of org.bouncycastle.crypto.params.ECPublicKeyParameters

            {
                throw new IllegalStateException("EC Key Pair Generator not initialised");
            }

            AsymmetricCipherKeyPair     pair = engine.generateKeyPair();
            ECPublicKeyParameters       pub = (ECPublicKeyParameters)pair.getPublic();
            ECPrivateKeyParameters      priv = (ECPrivateKeyParameters)pair.getPrivate();

            if (ecParams instanceof ECParameterSpec)
            {
                ECParameterSpec p = (ECParameterSpec)ecParams;
View Full Code Here

Examples of org.bouncycastle.crypto.params.ECPublicKeyParameters

            {
                throw new IllegalStateException("EC Key Pair Generator not initialised");
            }

            AsymmetricCipherKeyPair     pair = engine.generateKeyPair();
            ECPublicKeyParameters       pub = (ECPublicKeyParameters)pair.getPublic();
            ECPrivateKeyParameters      priv = (ECPrivateKeyParameters)pair.getPrivate();

            if (ecParams instanceof ECParameterSpec)
            {
                ECParameterSpec p = (ECParameterSpec)ecParams;
View Full Code Here

Examples of org.bouncycastle.crypto.params.ECPublicKeyParameters

      x9ECParameters.getG(),
      x9ECParameters.getN(),
      x9ECParameters.getH(),
      x9ECParameters.getSeed());

    ECPublicKeyParameters ecPublicKeyParameters = new ECPublicKeyParameters(
      q, ecDomainParameters);

    org.bouncycastle.crypto.signers.ECDSASigner verifier =
      new org.bouncycastle.crypto.signers.ECDSASigner();
View Full Code Here

Examples of org.bouncycastle2.crypto.params.ECPublicKeyParameters

            if (s == null)
            {
                s = ProviderUtil.getEcImplicitlyCa();

                return new ECPublicKeyParameters(
                            ((JCEECPublicKey)k).engineGetQ(),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN(), s.getH(), s.getSeed()));
            }
            else
            {
                return new ECPublicKeyParameters(
                            k.getQ(),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN(), s.getH(), s.getSeed()));
            }
        }
        else if (key instanceof java.security.interfaces.ECPublicKey)
        {
            java.security.interfaces.ECPublicKey pubKey = (java.security.interfaces.ECPublicKey)key;
            ECParameterSpec s = EC5Util.convertSpec(pubKey.getParams(), false);
            return new ECPublicKeyParameters(
                EC5Util.convertPoint(pubKey.getParams(), pubKey.getW(), false),
                            new ECDomainParameters(s.getCurve(), s.getG(), s.getN(), s.getH(), s.getSeed()));
        }

        throw new InvalidKeyException("cannot identify EC public key.");
View Full Code Here

Examples of org.bouncycastle2.crypto.params.ECPublicKeyParameters

            {
                throw new IllegalStateException("EC Key Pair Generator not initialised");
            }

            AsymmetricCipherKeyPair     pair = engine.generateKeyPair();
            ECPublicKeyParameters       pub = (ECPublicKeyParameters)pair.getPublic();
            ECPrivateKeyParameters      priv = (ECPrivateKeyParameters)pair.getPrivate();

            if (ecParams instanceof ECParameterSpec)
            {
                ECParameterSpec p = (ECParameterSpec)ecParams;
View Full Code Here

Examples of org.bouncycastle2.crypto.params.ECPublicKeyParameters

                throw new InvalidKeyException(kaAlgorithm + " key agreement requires "
                    + getSimpleName(MQVPublicKey.class) + " for doPhase");
            }

            MQVPublicKey mqvPubKey = (MQVPublicKey)key;
            ECPublicKeyParameters staticKey = (ECPublicKeyParameters)
                ECUtil.generatePublicKeyParameter(mqvPubKey.getStaticKey());
            ECPublicKeyParameters ephemKey = (ECPublicKeyParameters)
                ECUtil.generatePublicKeyParameter(mqvPubKey.getEphemeralKey());

            pubKey = new MQVPublicParameters(staticKey, ephemKey);

            // TODO Validate that all the keys are using the same parameters?
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.