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

69 lines
2.1 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.X509CertificateTokenFactoryCredential
// 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.IO;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
namespace Microsoft.InfoCards
{
internal class X509CertificateTokenFactoryCredential : TokenFactoryCredential
{
private X509Certificate2 m_cert;
private string m_contextKey;
private string m_portName;
private UIAgentRequest m_request;
private bool m_disposed;
private object m_sync = new object();
public X509CertificateTokenFactoryCredential(UIAgentRequest request)
: base(TokenFactoryCredentialType.X509CertificateCredential)
{
this.m_request = request;
}
public string ContextKey => this.m_contextKey;
public string PortName => this.m_portName;
public X509Certificate2 Certificate => this.m_cert;
protected override void DeserializeData(BinaryReader reader)
{
this.m_portName = Utility.DeserializeString(reader);
this.m_contextKey = Utility.DeserializeString(reader);
byte[] numArray = new byte[reader.ReadInt32()];
reader.Read(numArray, 0, numArray.Length);
this.m_cert = new X509Certificate2(numArray);
this.m_cert.PrivateKey = (AsymmetricAlgorithm) new RemoteCryptoRsaServiceProvider(this, this.m_request);
}
public override void Dispose(bool disposing)
{
if (this.m_disposed)
return;
lock (this.m_sync)
{
if (this.m_disposed)
return;
try
{
if (disposing)
{
this.m_cert.PrivateKey.Clear();
this.m_cert.PublicKey.Key.Clear();
}
this.m_disposed = true;
}
finally
{
base.Dispose(disposing);
}
}
}
}
}