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