mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-23 03:46:10 +00:00
111 lines
5.1 KiB
C#
111 lines
5.1 KiB
C#
|
// Decompiled with JetBrains decompiler
|
|||
|
// Type: Microsoft.InfoCards.GetBrowserTokenParameters
|
|||
|
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
|
|||
|
// MVID: 516D8B44-4448-4D2C-8B8E-FFBB3FFE472B
|
|||
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-69bb73081eac86b8cf86f45e33515d0095855636967076e2b593d7a30cd80a07.exe
|
|||
|
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Collections.ObjectModel;
|
|||
|
using System.IdentityModel.Selectors;
|
|||
|
using System.IdentityModel.Tokens;
|
|||
|
using System.IO;
|
|||
|
using System.ServiceModel.Security;
|
|||
|
using System.ServiceModel.Security.Tokens;
|
|||
|
using System.Xml;
|
|||
|
|
|||
|
namespace Microsoft.InfoCards
|
|||
|
{
|
|||
|
internal class GetBrowserTokenParameters
|
|||
|
{
|
|||
|
private GetBrowserTokenEndpoint m_recipient;
|
|||
|
private GetBrowserTokenEndpoint m_issuer;
|
|||
|
private Uri m_tokenType;
|
|||
|
private List<string> m_requiredClaims;
|
|||
|
private List<string> m_optionalClaims;
|
|||
|
private int m_flags;
|
|||
|
private uint m_privacyVersion;
|
|||
|
private Uri m_privacyUrl;
|
|||
|
|
|||
|
public GetBrowserTokenParameters()
|
|||
|
{
|
|||
|
this.m_recipient = new GetBrowserTokenEndpoint();
|
|||
|
this.m_issuer = new GetBrowserTokenEndpoint();
|
|||
|
this.m_requiredClaims = new List<string>();
|
|||
|
this.m_optionalClaims = new List<string>();
|
|||
|
}
|
|||
|
|
|||
|
public GetBrowserTokenEndpoint Recipient => this.m_recipient;
|
|||
|
|
|||
|
public GetBrowserTokenEndpoint Issuer => this.m_issuer;
|
|||
|
|
|||
|
public IList<string> RequiredClaims => (IList<string>) this.m_requiredClaims.AsReadOnly();
|
|||
|
|
|||
|
public IList<string> OptionalClaims => (IList<string>) this.m_optionalClaims.AsReadOnly();
|
|||
|
|
|||
|
public Uri PrivacyUrl => this.m_privacyUrl;
|
|||
|
|
|||
|
public uint PrivacyVersion => this.m_privacyVersion;
|
|||
|
|
|||
|
public void Load(BinaryReader reader, int paramVersion)
|
|||
|
{
|
|||
|
this.m_flags = paramVersion;
|
|||
|
this.m_recipient.Load(reader, paramVersion);
|
|||
|
this.m_issuer.Load(reader, paramVersion);
|
|||
|
string uriString1 = Utility.DeserializeString(reader);
|
|||
|
if (!string.IsNullOrEmpty(uriString1))
|
|||
|
this.m_tokenType = new Uri(uriString1);
|
|||
|
int num1 = reader.ReadInt32();
|
|||
|
for (int index = 0; index < num1; ++index)
|
|||
|
this.m_requiredClaims.Add(Utility.DeserializeString(reader));
|
|||
|
int num2 = reader.ReadInt32();
|
|||
|
for (int index = 0; index < num2; ++index)
|
|||
|
this.m_optionalClaims.Add(Utility.DeserializeString(reader));
|
|||
|
this.m_privacyVersion = reader.ReadUInt32();
|
|||
|
string uriString2 = Utility.DeserializeString(reader);
|
|||
|
if (!string.IsNullOrEmpty(uriString2))
|
|||
|
this.m_privacyUrl = new Uri(uriString2);
|
|||
|
else
|
|||
|
this.m_privacyUrl = (Uri) null;
|
|||
|
}
|
|||
|
|
|||
|
public CardSpacePolicyElement CreatePolicyElement(
|
|||
|
ProtocolProfile protocolProfile)
|
|||
|
{
|
|||
|
XmlDocument document = new XmlDocument();
|
|||
|
XmlElement element = document.CreateElement(protocolProfile.WSTrust.DefaultPrefix, protocolProfile.WSTrust.ClaimsElement, protocolProfile.WSTrust.Namespace);
|
|||
|
foreach (string requiredClaim in (IEnumerable<string>) this.RequiredClaims)
|
|||
|
element.AppendChild((XmlNode) GetBrowserTokenParameters.CreateClaimElement(document, requiredClaim, false));
|
|||
|
foreach (string optionalClaim in (IEnumerable<string>) this.OptionalClaims)
|
|||
|
element.AppendChild((XmlNode) GetBrowserTokenParameters.CreateClaimElement(document, optionalClaim, true));
|
|||
|
IssuedSecurityTokenParameters securityTokenParameters = new IssuedSecurityTokenParameters();
|
|||
|
if ((Uri) null != this.m_tokenType)
|
|||
|
securityTokenParameters.TokenType = this.m_tokenType.ToString();
|
|||
|
securityTokenParameters.AdditionalRequestParameters.Add(element);
|
|||
|
Collection<XmlElement> requestParameters = securityTokenParameters.CreateRequestParameters(protocolProfile.MsgSecurityVersion, (SecurityTokenSerializer) new WSSecurityTokenSerializer(protocolProfile.MsgSecurityVersion.SecurityVersion, true, (SamlSerializer) null, (SecurityStateEncoder) null, (IEnumerable<Type>) null));
|
|||
|
foreach (XmlElement xmlElement in requestParameters)
|
|||
|
{
|
|||
|
if (StringComparer.Ordinal.Equals(xmlElement.LocalName, protocolProfile.WSTrust.KeyType) && StringComparer.Ordinal.Equals(xmlElement.NamespaceURI, protocolProfile.WSTrust.Namespace))
|
|||
|
{
|
|||
|
xmlElement.RemoveAll();
|
|||
|
xmlElement.AppendChild((XmlNode) xmlElement.OwnerDocument.CreateTextNode(protocolProfile.WSTrust.KeyTypeBearer.OriginalString));
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
return new CardSpacePolicyElement(this.m_recipient != null ? this.m_recipient.CreateEndpointAddressXml() : (XmlElement) null, this.m_issuer != null ? this.m_issuer.CreateEndpointAddressXml() : (XmlElement) null, requestParameters, this.m_privacyUrl, Convert.ToInt32(this.m_privacyVersion), false);
|
|||
|
}
|
|||
|
|
|||
|
private static XmlElement CreateClaimElement(
|
|||
|
XmlDocument document,
|
|||
|
string claimUri,
|
|||
|
bool optional)
|
|||
|
{
|
|||
|
XmlElement element = document.CreateElement("wsid", "ClaimType", "http://schemas.xmlsoap.org/ws/2005/05/identity");
|
|||
|
element.SetAttribute("Uri", claimUri);
|
|||
|
if (optional)
|
|||
|
element.SetAttribute("Optional", "true");
|
|||
|
return element;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|