MalwareSourceCode/MSIL/Virus/Win32/E/Virus.Win32.Expiro.w-69bb73081eac86b8cf86f45e33515d0095855636967076e2b593d7a30cd80a07/Microsoft/InfoCards/OptionalRstParameters.cs

103 lines
3.9 KiB
C#
Raw Normal View History

2022-08-18 11:28:56 +00:00
// Decompiled with JetBrains decompiler
// Type: Microsoft.InfoCards.OptionalRstParameters
// 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 System.ServiceModel.Security;
using System.Xml;
namespace Microsoft.InfoCards
{
internal class OptionalRstParameters
{
private string m_tokenType = string.Empty;
private string m_signatureAlgorithm;
private string m_encryptionAlgorithm;
private string m_canonicalizationAlgorithm;
private string m_signWith;
private string m_encryptWith;
private string m_keyWrapAlgorithm;
public static OptionalRstParameters CreateMergedParameters(
OptionalRstParameters primary,
OptionalRstParameters secondary)
{
return new OptionalRstParameters()
{
m_canonicalizationAlgorithm = !string.IsNullOrEmpty(primary.m_canonicalizationAlgorithm) ? primary.m_canonicalizationAlgorithm : secondary.m_canonicalizationAlgorithm,
m_encryptionAlgorithm = !string.IsNullOrEmpty(primary.m_encryptionAlgorithm) ? primary.m_encryptionAlgorithm : secondary.m_encryptionAlgorithm,
m_encryptWith = !string.IsNullOrEmpty(primary.m_encryptWith) ? primary.m_encryptWith : secondary.m_encryptWith,
m_keyWrapAlgorithm = !string.IsNullOrEmpty(primary.m_keyWrapAlgorithm) || !string.IsNullOrEmpty(secondary.m_keyWrapAlgorithm) ? (!string.IsNullOrEmpty(primary.m_keyWrapAlgorithm) ? primary.m_keyWrapAlgorithm : secondary.m_keyWrapAlgorithm) : SecurityAlgorithmSuite.Default.DefaultAsymmetricKeyWrapAlgorithm,
m_signatureAlgorithm = !string.IsNullOrEmpty(primary.m_signatureAlgorithm) ? primary.m_signatureAlgorithm : secondary.m_signatureAlgorithm,
m_signWith = !string.IsNullOrEmpty(primary.m_signWith) ? primary.m_signWith : secondary.m_signWith,
m_tokenType = !string.IsNullOrEmpty(primary.m_tokenType) ? primary.m_tokenType : secondary.m_tokenType
};
}
public string SignatureAlgorithm
{
get => this.m_signatureAlgorithm;
set => this.m_signatureAlgorithm = value;
}
public string EncryptionAlgorithm
{
get => this.m_encryptionAlgorithm;
set => this.m_encryptionAlgorithm = value;
}
public string SignWith
{
get => this.m_signWith;
set => this.m_signWith = value;
}
public string EncryptWith
{
get => this.m_encryptWith;
set => this.m_encryptWith = value;
}
public string CanonicalizationAlgorithm
{
get => this.m_canonicalizationAlgorithm;
set => this.m_canonicalizationAlgorithm = value;
}
public string KeyWrapAlgorithm
{
get => this.m_keyWrapAlgorithm;
set => this.m_keyWrapAlgorithm = value;
}
public string TokenType
{
get => this.m_tokenType;
set => this.m_tokenType = value;
}
public void WritePassOnElements(XmlDictionaryWriter writer, ProtocolProfile profile)
{
string defaultPrefix = profile.WSTrust.DefaultPrefix;
if (!string.IsNullOrEmpty(this.TokenType))
{
writer.WriteStartElement(defaultPrefix, profile.WSTrust.TokenType, profile.WSTrust.Namespace);
writer.WriteString(this.TokenType);
writer.WriteEndElement();
}
if (!string.IsNullOrEmpty(this.SignatureAlgorithm))
{
writer.WriteStartElement(defaultPrefix, profile.WSTrust.SignatureAlgorithm, profile.WSTrust.Namespace);
writer.WriteString(this.SignatureAlgorithm);
writer.WriteEndElement();
}
if (string.IsNullOrEmpty(this.CanonicalizationAlgorithm))
return;
writer.WriteStartElement(defaultPrefix, profile.WSTrust.CanonicalizationAlgorithm, profile.WSTrust.Namespace);
writer.WriteString(this.CanonicalizationAlgorithm);
writer.WriteEndElement();
}
}
}