mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-19 09:56:10 +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: 516D8B44-4448-4D2C-8B8E-FFBB3FFE472B
|
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-69bb73081eac86b8cf86f45e33515d0095855636967076e2b593d7a30cd80a07.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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|