mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-22 19:36:11 +00:00
f2ac1ece55
add
108 lines
4.4 KiB
C#
108 lines
4.4 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Microsoft.InfoCards.SelfIssuedAuthAsymmetricKey
|
|
// 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 Microsoft.InfoCards.Diagnostics;
|
|
using System;
|
|
using System.IdentityModel.Tokens;
|
|
using System.Security.Cryptography;
|
|
|
|
namespace Microsoft.InfoCards
|
|
{
|
|
internal class SelfIssuedAuthAsymmetricKey : AsymmetricSecurityKey, IDisposable
|
|
{
|
|
private SelfIssuedAuthRSACryptoProvider m_selfIssuedAuthRsaCryptoProvider;
|
|
|
|
public SelfIssuedAuthAsymmetricKey(RSACryptoServiceProvider rsa) => this.m_selfIssuedAuthRsaCryptoProvider = new SelfIssuedAuthRSACryptoProvider(rsa);
|
|
|
|
public override int KeySize => this.m_selfIssuedAuthRsaCryptoProvider.KeySize;
|
|
|
|
public override bool HasPrivateKey()
|
|
{
|
|
InfoCardTrace.ThrowInvalidArgumentConditional(this.m_selfIssuedAuthRsaCryptoProvider.IsPublicOnly(), "selfIssuedRsaCrypoProvider");
|
|
return true;
|
|
}
|
|
|
|
public override AsymmetricAlgorithm GetAsymmetricAlgorithm(
|
|
string algorithmUri,
|
|
bool privateKey)
|
|
{
|
|
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 (AsymmetricAlgorithm) this.m_selfIssuedAuthRsaCryptoProvider;
|
|
default:
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException(SR.GetString("ClientUnsupportedCryptoAlgorithm", (object) algorithmUri)));
|
|
}
|
|
}
|
|
|
|
public override HashAlgorithm GetHashAlgorithmForSignature(string algorithmUri)
|
|
{
|
|
switch (algorithmUri)
|
|
{
|
|
case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
|
|
return (HashAlgorithm) new SHA1Managed();
|
|
default:
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException(SR.GetString("UnsupportedSignatureAlgorithm", (object) algorithmUri)));
|
|
}
|
|
}
|
|
|
|
public override AsymmetricSignatureDeformatter GetSignatureDeformatter(
|
|
string algorithmUri)
|
|
{
|
|
switch (algorithmUri)
|
|
{
|
|
case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
|
|
return (AsymmetricSignatureDeformatter) new SelfIssuedAuthRSAPKCS1SignatureDeformatter((AsymmetricAlgorithm) this.m_selfIssuedAuthRsaCryptoProvider);
|
|
default:
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException(SR.GetString("UnsupportedSignatureAlgorithm", (object) algorithmUri)));
|
|
}
|
|
}
|
|
|
|
public override AsymmetricSignatureFormatter GetSignatureFormatter(
|
|
string algorithmUri)
|
|
{
|
|
switch (algorithmUri)
|
|
{
|
|
case "http://www.w3.org/2000/09/xmldsig#rsa-sha1":
|
|
return (AsymmetricSignatureFormatter) new SelfIssuedAuthRSAPKCS1SignatureFormatter((AsymmetricAlgorithm) this.m_selfIssuedAuthRsaCryptoProvider);
|
|
default:
|
|
throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException(SR.GetString("UnsupportedSignatureAlgorithm", (object) algorithmUri)));
|
|
}
|
|
}
|
|
|
|
public override byte[] DecryptKey(string algorithmUri, byte[] keyData) => throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException());
|
|
|
|
public override byte[] EncryptKey(string algorithmUri, byte[] keyData) => throw InfoCardTrace.ThrowHelperError((Exception) new NotSupportedException());
|
|
|
|
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 true;
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public override bool IsSymmetricAlgorithm(string algorithmUri) => InfoCardCryptoHelper.IsSymmetricAlgorithm(algorithmUri);
|
|
|
|
public override bool IsAsymmetricAlgorithm(string algorithmUri) => InfoCardCryptoHelper.IsAsymmetricAlgorithm(algorithmUri);
|
|
|
|
public void Dispose()
|
|
{
|
|
if (this.m_selfIssuedAuthRsaCryptoProvider == null)
|
|
return;
|
|
this.m_selfIssuedAuthRsaCryptoProvider.Dispose();
|
|
this.m_selfIssuedAuthRsaCryptoProvider = (SelfIssuedAuthRSACryptoProvider) null;
|
|
}
|
|
}
|
|
}
|