mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-22 19:36:11 +00:00
f2ac1ece55
add
91 lines
3.5 KiB
C#
91 lines
3.5 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Microsoft.InfoCards.GetBrowserTokenEndpoint
|
|
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
|
|
// MVID: 1D4D5564-A025-490C-AF1D-DF4FBB709D1F
|
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Expiro.w-f8f9f26e940480624825f6bddbea86e70fc4aa746c4dd8efa7d98dcb477000ed.exe
|
|
|
|
using System;
|
|
using System.IO;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
using System.ServiceModel;
|
|
using System.ServiceModel.Channels;
|
|
using System.Text;
|
|
using System.Xml;
|
|
|
|
namespace Microsoft.InfoCards
|
|
{
|
|
internal class GetBrowserTokenEndpoint
|
|
{
|
|
private Uri m_address;
|
|
private Uri m_policyAddress;
|
|
private X509Certificate2Collection m_supportingCertsCollection = new X509Certificate2Collection();
|
|
private X509Certificate2 m_leafCert;
|
|
|
|
public Uri Address => this.m_address;
|
|
|
|
public Uri PolicyUrl => this.m_policyAddress;
|
|
|
|
public X509Certificate2Collection SupportingCertificates => this.m_supportingCertsCollection;
|
|
|
|
public X509Certificate2 LeafCertificate => this.m_leafCert;
|
|
|
|
public EndpointAddress CreateEndpointAddress()
|
|
{
|
|
if (!((Uri) null != this.m_address))
|
|
return (EndpointAddress) null;
|
|
return this.LeafCertificate != null ? new EndpointAddress(this.m_address, EndpointIdentity.CreateX509CertificateIdentity(this.LeafCertificate, this.SupportingCertificates), new AddressHeader[0]) : new EndpointAddress(this.m_address, new AddressHeader[0]);
|
|
}
|
|
|
|
public XmlElement CreateEndpointAddressXml()
|
|
{
|
|
if ((Uri) null != this.m_address)
|
|
{
|
|
EndpointAddress endpointAddress = this.LeafCertificate == null ? new EndpointAddress(this.m_address, new AddressHeader[0]) : new EndpointAddress(this.m_address, EndpointIdentity.CreateX509CertificateIdentity(this.LeafCertificate, this.SupportingCertificates), new AddressHeader[0]);
|
|
if ((EndpointAddress) null != endpointAddress)
|
|
{
|
|
using (MemoryStream memoryStream = new MemoryStream())
|
|
{
|
|
using (XmlWriter writer = (XmlWriter) new XmlTextWriter((Stream) memoryStream, Encoding.UTF8))
|
|
{
|
|
endpointAddress.WriteTo(AddressingVersion.WSAddressing10, writer);
|
|
writer.Flush();
|
|
memoryStream.Flush();
|
|
memoryStream.Seek(0L, SeekOrigin.Begin);
|
|
using (XmlReader readerWithQuotas = (XmlReader) Utility.CreateReaderWithQuotas((Stream) memoryStream))
|
|
return (XmlElement) new XmlDocument().ReadNode(readerWithQuotas);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return (XmlElement) null;
|
|
}
|
|
|
|
public void Load(BinaryReader reader, int paramVersion)
|
|
{
|
|
string uriString1 = Utility.DeserializeString(reader);
|
|
if (!string.IsNullOrEmpty(uriString1))
|
|
this.m_address = new Uri(uriString1);
|
|
string uriString2 = Utility.DeserializeString(reader);
|
|
if (!string.IsNullOrEmpty(uriString2))
|
|
this.m_policyAddress = new Uri(uriString2);
|
|
int num = 0;
|
|
if (2 == paramVersion)
|
|
num = reader.ReadInt32();
|
|
else if (1 == paramVersion)
|
|
num = 1;
|
|
for (int index = 0; index < num; ++index)
|
|
{
|
|
byte[] numArray = reader.ReadBytes(reader.ReadInt32());
|
|
if (!Utility.ArrayIsNullOrEmpty((Array) numArray))
|
|
{
|
|
X509Certificate2 certificate = new X509Certificate2(numArray);
|
|
if (index == 0)
|
|
this.m_leafCert = certificate;
|
|
else
|
|
this.m_supportingCertsCollection.Add(certificate);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|