MalwareSourceCode/MSIL/Virus/Win32/E/Virus.Win32.Expiro.w-1f15ee7e9f7da02b6bfb4c5a5e6484eb9fa71b82d3699c54bcc7a31794b4a66d/Microsoft/InfoCards/InfoCardClaim.cs

93 lines
3.2 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.InfoCardClaim
// 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.IO;
using System.Text;
namespace Microsoft.InfoCards
{
internal class InfoCardClaim
{
private string m_id;
private string m_claimValue;
private string m_displayTag;
private string m_description;
public InfoCardClaim()
{
}
public InfoCardClaim(string id, string value)
: this(id, value, (string) null, (string) null)
{
}
public InfoCardClaim(string id, string value, string description, string displaytag)
{
this.m_id = !string.IsNullOrEmpty(id) ? id : throw InfoCardTrace.ThrowHelperArgumentNull(nameof (id));
this.m_claimValue = value;
this.m_displayTag = displaytag;
this.m_description = description;
}
public string Id => this.m_id;
public string Value
{
get => this.m_claimValue;
set => this.m_claimValue = value;
}
public string DisplayTag => this.m_displayTag;
public string Description => this.m_description;
public override string ToString() => this.m_claimValue;
public void ThrowIfNotComplete()
{
if (string.IsNullOrEmpty(this.m_id))
throw InfoCardTrace.ThrowHelperError((Exception) new SerializationIncompleteException(this.GetType()));
}
public void Serialize(BinaryWriter writer)
{
this.ThrowIfNotComplete();
if (writer == null)
throw InfoCardTrace.ThrowHelperArgumentNull(nameof (writer));
Utility.SerializeString(writer, this.m_id);
Utility.SerializeString(writer, this.m_displayTag);
Utility.SerializeString(writer, this.m_description);
Utility.SerializeString(writer, this.m_claimValue);
}
public void DeSerialize(BinaryReader reader)
{
this.m_id = Utility.DeserializeString(reader);
this.m_displayTag = Utility.DeserializeString(reader);
this.m_description = Utility.DeserializeString(reader);
this.m_claimValue = Utility.DeserializeString(reader);
}
public void Encrypt(PinProtectionHelper pinHelper)
{
byte[] bytes = new UnicodeEncoding().GetBytes(this.m_claimValue);
this.m_claimValue = Convert.ToBase64String(pinHelper.Encrypt(bytes));
}
public void Decrypt(PinProtectionHelper pinHelper)
{
UnicodeEncoding unicodeEncoding = new UnicodeEncoding();
byte[] encrypted = Convert.FromBase64String(this.m_claimValue);
this.m_claimValue = unicodeEncoding.GetString(pinHelper.Decrypt(encrypted));
}
public InfoCardClaim Clone() => new InfoCardClaim((string) this.m_id.Clone(), string.IsNullOrEmpty(this.m_claimValue) ? (string) null : (string) this.m_claimValue.Clone(), string.IsNullOrEmpty(this.m_description) ? (string) null : (string) this.m_description.Clone(), string.IsNullOrEmpty(this.m_displayTag) ? (string) null : (string) this.m_displayTag.Clone());
}
}