Пример #1
0
        public override bool Equals(
            object obj)
        {
            if (obj == this)
            {
                return(true);
            }

            DHPublicKeyParameters other = obj as DHPublicKeyParameters;

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

            return(Equals(other));
        }
Пример #2
0
		/**
		 * given a message from a given party and the corresponding public key
		 * calculate the next message in the agreement sequence. In this case
		 * this will represent the shared secret.
		 */
		public BigInteger CalculateAgreement(
			DHPublicKeyParameters	pub,
			BigInteger				message)
		{
			if (pub == null)
				throw new ArgumentNullException("pub");
			if (message == null)
				throw new ArgumentNullException("message");

			if (!pub.Parameters.Equals(dhParams))
			{
				throw new ArgumentException("Diffie-Hellman public key has wrong parameters.");
			}

			BigInteger p = dhParams.P;

			return message.ModPow(key.X, p).Multiply(pub.Y.ModPow(privateValue, p)).Mod(p);
		}
Пример #3
0
 protected bool Equals(
     DHPublicKeyParameters other)
 {
     return(y.Equals(other.y) && base.Equals(other));
 }
Пример #4
0
		protected bool Equals(
			DHPublicKeyParameters other)
		{
			return y.Equals(other.y) && base.Equals(other);
		}