Пример #1
0
 public override int GetHashCode()
 {
     if (!X509Helper.IsValid(impl))
     {
         return(0);
     }
     return(impl.GetHashCode());
 }
Пример #2
0
 void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
 {
     if (!X509Helper.IsValid(impl))
     {
         throw new NullReferenceException();
     }
     // will throw a NRE if info is null (just like MS implementation)
     info.AddValue("RawData", impl.RawData);
 }
Пример #3
0
        public virtual string ToString(bool fVerbose)
        {
            if (!fVerbose || !X509Helper.IsValid(impl))
            {
                return(base.ToString());
            }

            return(impl.ToString(true));
        }
Пример #4
0
        public virtual string ToString(bool fVerbose)
        {
            if (!fVerbose || !X509Helper.IsValid(impl))
            {
                return(base.ToString());
            }

            StringBuilder sb = new StringBuilder();

            // Subject
            sb.AppendLine("[Subject]");
            sb.Append("  ");
            sb.AppendLine(Subject);

            // Issuer
            sb.AppendLine();
            sb.AppendLine("[Issuer]");
            sb.Append("  ");
            sb.AppendLine(Issuer);

            // Serial Number
            sb.AppendLine();
            sb.AppendLine("[Serial Number]");
            sb.Append("  ");
            byte[] serialNumber = GetSerialNumber();
            Array.Reverse(serialNumber);
            sb.Append(serialNumber.ToHexArrayUpper());
            sb.AppendLine();

            // NotBefore
            sb.AppendLine();
            sb.AppendLine("[Not Before]");
            sb.Append("  ");
            sb.AppendLine(FormatDate(GetNotBefore()));

            // NotAfter
            sb.AppendLine();
            sb.AppendLine("[Not After]");
            sb.Append("  ");
            sb.AppendLine(FormatDate(GetNotAfter()));

            // Thumbprint
            sb.AppendLine();
            sb.AppendLine("[Thumbprint]");
            sb.Append("  ");
            sb.Append(GetRawCertHash().ToHexArrayUpper());
            sb.AppendLine();

            return(sb.ToString());
        }
Пример #5
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));
            }
        }