mirror of
https://github.com/vxunderground/MalwareSourceCode.git
synced 2024-12-19 09:56:10 +00:00
f2ac1ece55
add
84 lines
2.8 KiB
C#
84 lines
2.8 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Microsoft.InfoCards.SymmetricCryptoSession
|
|
// 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.Diagnostics;
|
|
using System.IO;
|
|
using System.Security.Cryptography;
|
|
using System.Security.Principal;
|
|
|
|
namespace Microsoft.InfoCards
|
|
{
|
|
internal class SymmetricCryptoSession : CryptoSession
|
|
{
|
|
private SymmetricAlgorithm m_alg;
|
|
|
|
public SymmetricCryptoSession(
|
|
Process process,
|
|
DateTime expiration,
|
|
WindowsIdentity identity,
|
|
byte[] key)
|
|
: base(process, expiration, identity, (object) key, CryptoSession.SessionType.Symmetric)
|
|
{
|
|
this.m_alg = (SymmetricAlgorithm) new RijndaelManaged();
|
|
this.m_alg.Key = key;
|
|
}
|
|
|
|
protected override void OnDispose()
|
|
{
|
|
this.m_alg.Clear();
|
|
this.m_alg.Dispose();
|
|
this.m_alg = (SymmetricAlgorithm) null;
|
|
}
|
|
|
|
protected override void OnWrite(BinaryWriter bwriter)
|
|
{
|
|
bwriter.Write(this.m_alg.KeySize);
|
|
bwriter.Write(this.m_alg.BlockSize);
|
|
bwriter.Write(this.m_alg.FeedbackSize);
|
|
}
|
|
|
|
public byte[] GenerateDerivedKey(
|
|
string algorithmUri,
|
|
byte[] label,
|
|
byte[] nonce,
|
|
int derivedKeyLength,
|
|
int offset)
|
|
{
|
|
if (algorithmUri == "http://schemas.xmlsoap.org/ws/2005/02/sc/dk/p_sha1" || algorithmUri == "http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/dk/p_sha1")
|
|
return new Psha1DerivedKeyGenerator(this.m_alg.Key).GenerateDerivedKey(label, nonce, derivedKeyLength, offset);
|
|
throw InfoCardTrace.ThrowHelperWarning((Exception) new InfoCardArgumentException(SR.GetString("ServiceUnsupportedKeyDerivationAlgorithm", (object) algorithmUri)));
|
|
}
|
|
|
|
public TransformCryptoSession GetCryptoTransform(
|
|
CipherMode mode,
|
|
PaddingMode padding,
|
|
int feedbackSize,
|
|
SymmetricCryptoSession.Direction direction,
|
|
byte[] iv)
|
|
{
|
|
this.m_alg.Mode = mode;
|
|
this.m_alg.Padding = padding;
|
|
this.m_alg.IV = iv;
|
|
return new TransformCryptoSession(this.ProcessObj, this.Expiration, this.Identity, SymmetricCryptoSession.Direction.Encrypt != direction ? this.m_alg.CreateDecryptor() : this.m_alg.CreateEncryptor());
|
|
}
|
|
|
|
public HashCryptoSession GetKeyedHash()
|
|
{
|
|
KeyedHashAlgorithm hash = (KeyedHashAlgorithm) new HMACSHA1(this.m_alg.Key);
|
|
hash.Initialize();
|
|
return new HashCryptoSession(this.ProcessObj, this.Expiration, this.Identity, hash);
|
|
}
|
|
|
|
public enum Direction
|
|
{
|
|
Encrypt = 1,
|
|
Decrypt = 2,
|
|
}
|
|
}
|
|
}
|