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(); }
protected bool Equals(ECKeyParameters other) { if (parameters.Equals(other.parameters)) { return(Equals((AsymmetricKeyParameter)other)); } return(false); }
protected bool Equals( ECKeyParameters other) { return(parameters.Equals(other.parameters) && base.Equals(other)); }
protected bool Equals(ECKeyParameters other) { return(parameters.Equals(other.parameters) && Equals((AsymmetricKeyParameter)other)); }
public static bool AreOnSameCurve(ECDomainParameters a, ECDomainParameters b) { return a != null && a.Equals(b); }