Equals() protected method

protected Equals ( ECDomainParameters other ) : bool
other ECDomainParameters
return bool
Ejemplo n.º 1
0
        public MqvPrivateParameters(ECPrivateKeyParameters staticPrivateKey, ECPrivateKeyParameters ephemeralPrivateKey, ECPublicKeyParameters ephemeralPublicKey)
        {
            if (staticPrivateKey == null)
            {
                throw new ArgumentNullException("staticPrivateKey");
            }
            if (ephemeralPrivateKey == null)
            {
                throw new ArgumentNullException("ephemeralPrivateKey");
            }
            ECDomainParameters parameters = staticPrivateKey.Parameters;

            if (!parameters.Equals(ephemeralPrivateKey.Parameters))
            {
                throw new ArgumentException("Static and ephemeral private keys have different domain parameters");
            }
            if (ephemeralPublicKey == null)
            {
                ephemeralPublicKey = new ECPublicKeyParameters(parameters.G.Multiply(ephemeralPrivateKey.D), parameters);
            }
            else if (!parameters.Equals(ephemeralPublicKey.Parameters))
            {
                throw new ArgumentException("Ephemeral public key has different domain parameters");
            }
            this.staticPrivateKey    = staticPrivateKey;
            this.ephemeralPrivateKey = ephemeralPrivateKey;
            this.ephemeralPublicKey  = ephemeralPublicKey;
        }
        public SM2KeyExchangePrivateParameters(
            bool initiator,
            ECPrivateKeyParameters staticPrivateKey,
            ECPrivateKeyParameters ephemeralPrivateKey)
        {
            if (staticPrivateKey == null)
            {
                throw new ArgumentNullException("staticPrivateKey");
            }
            if (ephemeralPrivateKey == null)
            {
                throw new ArgumentNullException("ephemeralPrivateKey");
            }

            ECDomainParameters parameters = staticPrivateKey.Parameters;

            if (!parameters.Equals(ephemeralPrivateKey.Parameters))
            {
                throw new ArgumentException("Static and ephemeral private keys have different domain parameters");
            }

            this.mInitiator            = initiator;
            this.mStaticPrivateKey     = staticPrivateKey;
            this.mStaticPublicPoint    = parameters.G.Multiply(staticPrivateKey.D).Normalize();
            this.mEphemeralPrivateKey  = ephemeralPrivateKey;
            this.mEphemeralPublicPoint = parameters.G.Multiply(ephemeralPrivateKey.D).Normalize();
        }
Ejemplo n.º 3
0
 protected bool Equals(ECKeyParameters other)
 {
     if (parameters.Equals(other.parameters))
     {
         return(Equals((AsymmetricKeyParameter)other));
     }
     return(false);
 }
Ejemplo n.º 4
0
 protected bool Equals(
     ECKeyParameters other)
 {
     return(parameters.Equals(other.parameters) && base.Equals(other));
 }
Ejemplo n.º 5
0
 protected bool Equals(ECKeyParameters other)
 {
     return(parameters.Equals(other.parameters) && Equals((AsymmetricKeyParameter)other));
 }
Ejemplo n.º 6
0
 public static bool AreOnSameCurve(ECDomainParameters a, ECDomainParameters b)
 {
     return a != null && a.Equals(b);
 }