MalwareSourceCode/MSIL/Virus/Win32/E/Virus.Win32.Expiro.w-67b630ead60119692b9abbdfd8717c96904ef041127c2cae033c86b718eaa61e/Microsoft/InfoCards/GetBrowserTokenEndpoint.cs

91 lines
3.5 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.GetBrowserTokenEndpoint
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
// MVID: ADE0A079-11DB-4A46-8BDE-D2A592CA8DEA
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00000-msil\Virus.Win32.Expiro.w-67b630ead60119692b9abbdfd8717c96904ef041127c2cae033c86b718eaa61e.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);
}
}
}
}
}