mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-19 18:06:10 +00:00
f2ac1ece55
add
81 lines
2.8 KiB
C#
81 lines
2.8 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Microsoft.InfoCards.RemoteX509AsymmetricSecurityKey
|
|
// Assembly: infocard, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
|
|
// MVID: ADE0A079-11DB-4A46-8BDE-D2A592CA8DEA
|
|
// Assembly location: C:\Users\Administrateur\Downloads\Virusshare-00001-msil\Virus.Win32.Expiro.w-1f15ee7e9f7da02b6bfb4c5a5e6484eb9fa71b82d3699c54bcc7a31794b4a66d.exe
|
|
|
|
using Microsoft.InfoCards.Diagnostics;
|
|
using System;
|
|
using System.IdentityModel.Tokens;
|
|
using System.Security.Cryptography;
|
|
using System.Security.Cryptography.X509Certificates;
|
|
|
|
namespace Microsoft.InfoCards
|
|
{
|
|
internal class RemoteX509AsymmetricSecurityKey : X509AsymmetricSecurityKey, IDisposable
|
|
{
|
|
private X509Certificate2 m_cert;
|
|
private object m_sync;
|
|
private bool m_disposed;
|
|
|
|
public RemoteX509AsymmetricSecurityKey(X509Certificate2 cert)
|
|
: base(cert)
|
|
{
|
|
this.m_cert = cert;
|
|
if (!(this.m_cert.PrivateKey is RemoteCryptoRsaServiceProvider))
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException());
|
|
this.m_sync = new object();
|
|
}
|
|
|
|
public override AsymmetricAlgorithm GetAsymmetricAlgorithm(
|
|
string algorithmUri,
|
|
bool privateKey)
|
|
{
|
|
return this.IsSupportedAlgorithm(algorithmUri) ? base.GetAsymmetricAlgorithm(algorithmUri, privateKey) : throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException());
|
|
}
|
|
|
|
public override AsymmetricSignatureDeformatter GetSignatureDeformatter(
|
|
string algorithmUri)
|
|
{
|
|
return this.IsSupportedAlgorithm(algorithmUri) ? base.GetSignatureDeformatter(algorithmUri) : throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException());
|
|
}
|
|
|
|
public override AsymmetricSignatureFormatter GetSignatureFormatter(
|
|
string algorithmUri)
|
|
{
|
|
if (!this.IsSupportedAlgorithm(algorithmUri))
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException());
|
|
RemoteAsymmetricSignatureFormatter signatureFormatter = new RemoteAsymmetricSignatureFormatter();
|
|
signatureFormatter.SetKey(this.m_cert.PrivateKey);
|
|
return (AsymmetricSignatureFormatter) signatureFormatter;
|
|
}
|
|
|
|
public override bool IsSupportedAlgorithm(string algorithmUri)
|
|
{
|
|
switch (algorithmUri)
|
|
{
|
|
case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
|
|
case "http://www.w3.org/2001/04/xmlenc#rsa-1_5":
|
|
case "http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p":
|
|
return base.IsSupportedAlgorithm(algorithmUri);
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
void IDisposable.Dispose()
|
|
{
|
|
if (this.m_disposed)
|
|
return;
|
|
lock (this.m_sync)
|
|
{
|
|
if (this.m_disposed)
|
|
return;
|
|
this.m_disposed = true;
|
|
this.m_cert.PrivateKey?.Dispose();
|
|
this.m_cert.PublicKey.Key?.Dispose();
|
|
}
|
|
}
|
|
}
|
|
}
|