Exemplo n.º 1
0
        // public methods

        public virtual bool Equals(System.Security.Cryptography.X509Certificates.X509Certificate other)
        {
            if (other == null)
            {
                return(false);
            }
            else
            {
                if (!X509Helper.IsValid(other.impl))
                {
                    if (!X509Helper.IsValid(impl))
                    {
                        return(true);
                    }
                    throw new CryptographicException(Locale.GetText("Certificate instance is empty."));
                }

                return(X509CertificateImpl.Equals(impl, other.impl));
            }
        }
Exemplo n.º 2
0
        public static bool Equals(X509CertificateImpl first, X509CertificateImpl second)
        {
            if (!IsValid(first) || !IsValid(second))
            {
                return(false);
            }

            bool result;

            if (first.Equals(second, out result))
            {
                return(result);
            }

            var firstRaw  = first.RawData;
            var secondRaw = second.RawData;

            if (firstRaw == null)
            {
                return(secondRaw == null);
            }
            else if (secondRaw == null)
            {
                return(false);
            }

            if (firstRaw.Length != secondRaw.Length)
            {
                return(false);
            }

            for (int i = 0; i < firstRaw.Length; i++)
            {
                if (firstRaw [i] != secondRaw [i])
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 3
0
		public static bool Equals (X509CertificateImpl first, X509CertificateImpl second)
		{
			if (!IsValid (first) || !IsValid (second))
				return false;

			bool result;
			if (first.Equals (second, out result))
				return result;

			var firstRaw = first.GetRawCertData ();
			var secondRaw = second.GetRawCertData ();

			if (firstRaw == null)
				return secondRaw == null;
			else if (secondRaw == null)
				return false;

			if (firstRaw.Length != secondRaw.Length)
				return false;

			for (int i = 0; i < firstRaw.Length; i++) {
				if (firstRaw [i] != secondRaw [i])
					return false;
			}

			return true;
		}