internal void SaveAsElement(XmlWriter writer)
        {
            writer.WriteStartElement("SupportedFramework");
            if (MaximumVersion != NoMaximumVersion)
            {
                writer.WriteAttributeString("MaximumVersion", MaximumVersion.ToString());
            }
            if (MinimumVersion != NoMinimumVersion)
            {
                writer.WriteAttributeString("MinimumVersion", MinimumVersion.ToString());
            }
            WriteNonEmptyAttribute("Profile", Profile);
            WriteNonEmptyAttribute("Identifier", Identifier);
            WriteNonEmptyAttribute("DisplayName", DisplayName);
            WriteNonEmptyAttribute("MinimumVersionDisplayName", MinimumVersionDisplayName);
            WriteNonEmptyAttribute("MonoSpecificVersion", MonoSpecificVersion);
            WriteNonEmptyAttribute("MonoSpecificVersionDisplayName", MonoSpecificVersionDisplayName);

            writer.WriteEndElement();

            void WriteNonEmptyAttribute(string name, string val)
            {
                if (!string.IsNullOrEmpty(val))
                {
                    writer.WriteAttributeString(name, val);
                }
            }
        }
Example #2
0
 public virtual void NotifyFallback(bool isFallback)
 {
     /*
      * RFC 7507 3. If TLS_FALLBACK_SCSV appears in ClientHello.cipher_suites and the highest
      * protocol version supported by the server is higher than the version indicated in
      * ClientHello.client_version, the server MUST respond with a fatal inappropriate_fallback
      * alert [..].
      */
     if (isFallback && MaximumVersion.IsLaterVersionOf(mClientVersion))
     {
         throw new TlsFatalAlert(AlertDescription.inappropriate_fallback);
     }
 }
Example #3
0
 public virtual void NotifyFallback(bool isFallback)
 {
     /*
      * draft-ietf-tls-downgrade-scsv-00 3. If TLS_FALLBACK_SCSV appears in
      * ClientHello.cipher_suites and the highest protocol version supported by the server is
      * higher than the version indicated in ClientHello.client_version, the server MUST respond
      * with an inappropriate_fallback alert.
      */
     if (isFallback && MaximumVersion.IsLaterVersionOf(mClientVersion))
     {
         throw new TlsFatalAlert(AlertDescription.inappropriate_fallback);
     }
 }
        public override bool Equals(object obj)
        {
            var other = obj as SupportedFramework;

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

            if (!string.Equals(DisplayName, other.DisplayName))
            {
                return(false);
            }
            if (!string.Equals(Identifier, other.Identifier))
            {
                return(false);
            }
            if (!string.Equals(Profile, other.Profile))
            {
                return(false);
            }
            if (!string.Equals(MonoSpecificVersion, other.MonoSpecificVersion))
            {
                return(false);
            }
            if (!string.Equals(MonoSpecificVersionDisplayName, other.MonoSpecificVersionDisplayName))
            {
                return(false);
            }
            if (!string.Equals(MinimumVersionDisplayName, other.MinimumVersionDisplayName))
            {
                return(false);
            }
            if (!MinimumVersion.Equals(other.MinimumVersion))
            {
                return(false);
            }
            if (!MaximumVersion.Equals(other.MaximumVersion))
            {
                return(false);
            }
            return(true);
        }
Example #5
0
 public override string ToString() => $"{(MinimumInclusive ? "[" : "(")}{MinimumVersion?.ToString(false) ?? ""},{MaximumVersion?.ToString(false) ?? ""}{(MaximumInclusive ? "]" : ")")}";
Example #6
0
 public override int GetHashCode() => (((MinimumVersion?.GetHashCode() ?? -1) << 8) ^ (MaximumVersion?.GetHashCode() ?? -1)) ^ (MinimumInclusive ? 0b10 : 0) ^ (MaximumInclusive ? 0b1 : 0);