public ECKeyGenerationParameters(
     EcDomainParameters domainParameters,
     SecureRandom random)
     : base(random, domainParameters.N.BitLength)
 {
     this.domainParams = domainParameters;
 }
Exemple #2
0
 protected bool Equals(
     EcDomainParameters other)
 {
     return(curve.Equals(other.curve) &&
            g.Equals(other.g) &&
            n.Equals(other.n) &&
            h.Equals(other.h) &&
            Arrays.AreEqual(seed, other.seed));
 }
        public ECPrivateKeyParameters(
            string algorithm,
            BigInteger d,
            EcDomainParameters parameters)
            : base(algorithm, true, parameters)
        {
            if (d == null)
            {
                throw new ArgumentNullException("d");
            }

            this.d = d;
        }
        public ECPublicKeyParameters(
            string algorithm,
            ECPoint q,
            EcDomainParameters parameters)
            : base(algorithm, false, parameters)
        {
            if (q == null)
            {
                throw new ArgumentNullException("q");
            }

            this.q = q.Normalize();
        }
Exemple #5
0
            internal override void Evaluate()
            {
                X9ECParameters p = NistNamedCurves.GetByName("P-256");

                Org.BouncyCastle.Crypto.Internal.Parameters.EcDomainParameters parameters = new Org.BouncyCastle.Crypto.Internal.Parameters.EcDomainParameters(p.Curve, p.G, p.N, p.H);
                BigInteger dValue = new BigInteger(1, FipsKats.Values[FipsKats.Vec.ECPrimitiveStartupVec]);

                ECPoint Q = parameters.Curve.DecodePoint(Hex.Decode("03596375E6CE57E0F20294FC46BDFCFD19A39F8161B58695B3EC5B3D16427C274D"));

                if (!Q.Equals(parameters.G.Multiply(dValue)))
                {
                    Fail("EC primitive 'Z' computation failed");
                }
            }
Exemple #6
0
        public override bool Equals(
            object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            EcDomainParameters other = obj as EcDomainParameters;

            if (other == null)
            {
                return(false);
            }

            return(Equals(other));
        }
Exemple #7
0
        protected ECKeyParameters(
            string algorithm,
            bool isPrivate,
            EcDomainParameters parameters)
            : base(isPrivate)
        {
            if (algorithm == null)
            {
                throw new ArgumentNullException("algorithm");
            }
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            this.algorithm  = VerifyAlgorithmName(algorithm);
            this.parameters = parameters;
        }
Exemple #8
0
        protected ECKeyParameters(
            string algorithm,
            bool isPrivate,
            DerObjectIdentifier publicKeyParamSet)
            : base(isPrivate)
        {
            if (algorithm == null)
            {
                throw new ArgumentNullException("algorithm");
            }
            if (publicKeyParamSet == null)
            {
                throw new ArgumentNullException("publicKeyParamSet");
            }

            this.algorithm         = VerifyAlgorithmName(algorithm);
            this.parameters        = LookupParameters(publicKeyParamSet);
            this.publicKeyParamSet = publicKeyParamSet;
        }
Exemple #9
0
        internal static EcDomainParameters LookupParameters(
            DerObjectIdentifier publicKeyParamSet)
        {
            if (publicKeyParamSet == null)
            {
                throw new ArgumentNullException("publicKeyParamSet");
            }

            EcDomainParameters p = ECGost3410NamedCurves.GetByOid(publicKeyParamSet);

            if (p == null)
            {
                X9ECParameters x9 = ECKeyPairGenerator.FindECCurveByOid(publicKeyParamSet);

                if (x9 == null)
                {
                    throw new ArgumentException("OID is not a valid public key parameter set", "publicKeyParamSet");
                }

                p = new EcDomainParameters(x9.Curve, x9.G, x9.N, x9.H, x9.GetSeed());
            }

            return(p);
        }
 public ECPrivateKeyParameters(
     BigInteger d,
     EcDomainParameters parameters)
     : this("EC", d, parameters)
 {
 }
 public ECPublicKeyParameters(
     ECPoint q,
     EcDomainParameters parameters)
     : this("EC", q, parameters)
 {
 }