MalwareSourceCode/MSIL/Virus/Win32/E/Virus.Win32.Expiro.w-1f15ee7e9f7da02b6bfb4c5a5e6484eb9fa71b82d3699c54bcc7a31794b4a66d/Microsoft/InfoCards/InfoCardConstants.cs
2022-08-18 06:28:56 -05:00

190 lines
12 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.InfoCardConstants
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: ADE0A079-11DB-4A46-8BDE-D2A592CA8DEA
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Expiro.w-1f15ee7e9f7da02b6bfb4c5a5e6484eb9fa71b82d3699c54bcc7a31794b4a66d.exe
using Microsoft.InfoCards.Diagnostics;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.IdentityModel.Claims;
using System.Xml;
namespace Microsoft.InfoCards
{
internal static class InfoCardConstants
{
private const int DEFAULT_MAX_MESSAGE_SIZE = 20971520;
private const int DEFAULT_MAX_MEX_CHAIN = 100;
private const string MAX_MESSAGE_KEY = "MaximumMessageSize";
private const string MAX_MEX_CHAIN = "MaximumMexChain";
private const string INFOCARD_REGISTRY_KEY = "software\\microsoft\\infocard";
private static int s_maxMessageSize;
private static int s_maxMexChainLength;
private static string[] s_SelfIssuedClaims = new string[14]
{
InfoCardConstants.GivenName,
InfoCardConstants.Surname,
InfoCardConstants.EmailAddress,
InfoCardConstants.StreetAddress,
InfoCardConstants.Locality,
InfoCardConstants.StateOrProvince,
InfoCardConstants.PostalCode,
InfoCardConstants.Country,
InfoCardConstants.HomePhone,
InfoCardConstants.OtherPhone,
InfoCardConstants.MobilePhone,
InfoCardConstants.DateOfBirth,
InfoCardConstants.Gender,
InfoCardConstants.Webpage
};
private static Dictionary<string, string> s_claimDisplayTags = new Dictionary<string, string>();
private static Dictionary<string, string> s_claimDescription = new Dictionary<string, string>();
private static XmlDictionaryReaderQuotas s_defaultQuotas = new XmlDictionaryReaderQuotas();
private static List<string> s_localTokenFactoryWhiteList = new List<string>();
private static List<string> s_policyElementsToBeProcessed = new List<string>();
public static int MaximumMessageSize => InfoCardConstants.s_maxMessageSize;
public static int MaximumMexChainLength => InfoCardConstants.s_maxMexChainLength;
public static string RegistryKey => "software\\microsoft\\infocard";
public static string GivenName => ClaimTypes.GivenName;
public static string EmailAddress => ClaimTypes.Email;
public static string Surname => ClaimTypes.Surname;
public static string StreetAddress => ClaimTypes.StreetAddress;
public static string Locality => ClaimTypes.Locality;
public static string StateOrProvince => ClaimTypes.StateOrProvince;
public static string PostalCode => ClaimTypes.PostalCode;
public static string Country => ClaimTypes.Country;
public static string HomePhone => ClaimTypes.HomePhone;
public static string OtherPhone => ClaimTypes.OtherPhone;
public static string MobilePhone => ClaimTypes.MobilePhone;
public static string DateOfBirth => ClaimTypes.DateOfBirth;
public static string Gender => ClaimTypes.Gender;
public static string PPID => ClaimTypes.PPID;
public static string Webpage => ClaimTypes.Webpage;
public static bool DoesLocalTokenFactoryWhiteListContain(string nameSpaceValue, string value) => InfoCardConstants.s_localTokenFactoryWhiteList.Contains(nameSpaceValue + "/" + value);
public static bool DoesPolicyElementsToBeProcessedListContain(
string nameSpaceValue,
string value)
{
return InfoCardConstants.s_policyElementsToBeProcessed.Contains(nameSpaceValue + "/" + value);
}
public static XmlDictionaryReaderQuotas DefaultQuotas => InfoCardConstants.s_defaultQuotas;
public static string[] SelfIssuedClaimsUris => InfoCardConstants.s_SelfIssuedClaims;
public static string PPIDClaimsUri => InfoCardConstants.PPID;
public static string ClaimDisplayTag(string key) => InfoCardConstants.s_claimDisplayTags.ContainsKey(key) ? SR.GetString(InfoCardConstants.s_claimDisplayTags[key]) : throw InfoCardTrace.ThrowHelperWarning((Exception) new ArgumentOutOfRangeException(SR.GetString("InvalidSelfIssuedUri")));
public static string ClaimsDescription(string key) => InfoCardConstants.s_claimDescription.ContainsKey(key) ? SR.GetString(InfoCardConstants.s_claimDescription[key]) : throw InfoCardTrace.ThrowHelperWarning((Exception) new ArgumentOutOfRangeException(SR.GetString("InvalidSelfIssuedUri")));
static InfoCardConstants()
{
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.GivenName, "GivenNameText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.EmailAddress, "EmailAddressText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.Country, "CountryText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.DateOfBirth, "DateOfBirthText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.Gender, "GenderText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.HomePhone, "HomePhoneText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.Locality, "LocalityText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.MobilePhone, "MobilePhoneText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.OtherPhone, "OtherPhoneText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.PostalCode, "PostalCodeText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.StateOrProvince, "StateOrProvinceText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.StreetAddress, "StreetAddressText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.Surname, "SurnameText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.PPID, "PPIDText");
InfoCardConstants.s_claimDisplayTags.Add(InfoCardConstants.Webpage, "WebPageText");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.GivenName, "GivenNameDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.EmailAddress, "EmailAddressDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.Country, "CountryDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.DateOfBirth, "DateOfBirthDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.Gender, "GenderDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.HomePhone, "HomePhoneDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.Locality, "LocalityDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.MobilePhone, "MobilePhoneDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.OtherPhone, "OtherPhoneDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.PostalCode, "PostalCodeDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.StateOrProvince, "StateOrProvinceDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.StreetAddress, "StreetAddressDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.Surname, "SurnameDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.PPID, "PPIDDescription");
InfoCardConstants.s_claimDescription.Add(InfoCardConstants.Webpage, "WebPageDescription");
InfoCardConstants.s_defaultQuotas.MaxDepth = 32;
InfoCardConstants.s_defaultQuotas.MaxStringContentLength = 8192;
InfoCardConstants.s_defaultQuotas.MaxArrayLength = 20971520;
InfoCardConstants.s_defaultQuotas.MaxBytesPerRead = 4096;
InfoCardConstants.s_defaultQuotas.MaxNameTableCharCount = 16384;
InfoCardConstants.s_maxMessageSize = 20971520;
InfoCardConstants.s_maxMexChainLength = 100;
using (new SystemIdentity(false))
{
using (Microsoft.Win32.RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("software\\microsoft\\infocard", false))
{
if (registryKey != null)
{
object obj1 = registryKey.GetValue(nameof (MaximumMessageSize), (object) 20971520);
if (obj1 is int num1 && num1 > 0 && (int) obj1 * 1024 > 0)
InfoCardConstants.s_maxMessageSize = (int) obj1 * 1024;
object obj2 = registryKey.GetValue("MaximumMexChain", (object) 100);
if (obj2 is int num2)
{
if (num2 > 0)
InfoCardConstants.s_maxMexChainLength = (int) obj2;
}
}
}
}
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/SignatureAlgorithm");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/EncryptionAlgorithm");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/CanonicalizationAlgorithm");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/SignWith");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/Claims");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/TokenType");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/KeyType");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/KeySize");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/EncryptWith");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/02/trust/RequestType");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/SignatureAlgorithm");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/EncryptionAlgorithm");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/CanonicalizationAlgorithm");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/SignWith");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/Claims");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/TokenType");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/KeyType");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/KeySize");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/EncryptWith");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RequestType");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/SecondaryParameters");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-trust/200512/KeyWrapAlgorithm");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/RequestSecurityTokenTemplate");
InfoCardConstants.s_localTokenFactoryWhiteList.Add("http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200512/RequestSecurityTokenTemplate");
InfoCardConstants.s_policyElementsToBeProcessed.AddRange((IEnumerable<string>) InfoCardConstants.s_localTokenFactoryWhiteList);
InfoCardConstants.s_policyElementsToBeProcessed.Add("http://schemas.xmlsoap.org/ws/2004/09/policy/AppliesTo");
InfoCardConstants.s_policyElementsToBeProcessed.Add("http://www.w3.org/ns/ws-policy/AppliesTo");
}
}
}