Exemplo n.º 1
0
        public override int GetHashCode()
        {
            int hashCode = AlternateNameType.GetHashCode();

            if (m_blob.Length > 4)
            {
                for (int i = 0; i < m_blob.Length; i += 4)
                {
                    hashCode ^= BitConverter.ToInt32(m_blob, i);
                }
            }

            if (m_blob.Length > 0 && m_blob.Length % 4 != 0)
            {
                int remainder = 0;
                for (int i = 0; i < m_blob.Length % 4; ++i)
                {
                    remainder |= (m_blob[m_blob.Length - i - 1]) << (8 * i);
                }

                hashCode ^= remainder;
            }

            return(hashCode);
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Create an alternate name for the given string
        /// </summary>
        /// <exception cref="ArgumentNullException">if <paramref name="name"/> is null</exception>
        public X509AlternateNameString(AlternateNameType type, string name) : base(type)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            m_name = name;
        }
        /// <summary>
        ///     Create an alternate name for the given IP address
        /// </summary>
        /// <exception cref="ArgumentNullException">if <paramref name="address"/> is null</exception>
        public X509AlternateNameIPAddress(AlternateNameType type, IPAddress address) : base(type)
        {
            if (address == null)
            {
                throw new ArgumentNullException("address");
            }

            m_address = address;
        }
Exemplo n.º 4
0
        /// <summary>
        ///     Create an alternate name for the given blob
        /// </summary>
        /// <exception cref="ArgumentNullException">if <paramref name="blob"/> is null</exception>
        public X509AlternateNameBlob(AlternateNameType type, byte[] blob)
            : base(type)
        {
            if (blob == null)
                throw new ArgumentNullException("blob");

            m_blob = new byte[blob.Length];
            Array.Copy(blob, m_blob, m_blob.Length);
        }
Exemplo n.º 5
0
 public override int GetHashCode()
 {
     return(AlternateNameType.GetHashCode());
 }
Exemplo n.º 6
0
 /// <summary>
 ///     Construct an empty X509AlternateName of the specified type
 /// </summary>
 public X509AlternateName(AlternateNameType type)
 {
     m_type = type;
 }
Exemplo n.º 7
0
 public override string ToString()
 {
     return(AlternateNameType.ToString());
 }