Files
2026-06-04 11:42:34 +02:00

891 lines
38 KiB
C#

using System;
using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
using Mono.Xml;
namespace System.Security.Cryptography
{
/// <summary>Accesses the cryptography configuration information.</summary>
// Token: 0x020004ED RID: 1261
[ComVisible(true)]
public class CryptoConfig
{
// Token: 0x06002EAC RID: 11948 RVA: 0x000952E8 File Offset: 0x000934E8
private static void Initialize()
{
Hashtable hashtable = new Hashtable(new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer());
hashtable.Add("SHA", "System.Security.Cryptography.SHA1CryptoServiceProvider");
hashtable.Add("SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.SHA1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.HashAlgorithm", "System.Security.Cryptography.SHA1CryptoServiceProvider");
hashtable.Add("MD5", "System.Security.Cryptography.MD5CryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.MD5", "System.Security.Cryptography.MD5CryptoServiceProvider");
hashtable.Add("SHA256", "System.Security.Cryptography.SHA256Managed");
hashtable.Add("SHA-256", "System.Security.Cryptography.SHA256Managed");
hashtable.Add("System.Security.Cryptography.SHA256", "System.Security.Cryptography.SHA256Managed");
hashtable.Add("SHA384", "System.Security.Cryptography.SHA384Managed");
hashtable.Add("SHA-384", "System.Security.Cryptography.SHA384Managed");
hashtable.Add("System.Security.Cryptography.SHA384", "System.Security.Cryptography.SHA384Managed");
hashtable.Add("SHA512", "System.Security.Cryptography.SHA512Managed");
hashtable.Add("SHA-512", "System.Security.Cryptography.SHA512Managed");
hashtable.Add("System.Security.Cryptography.SHA512", "System.Security.Cryptography.SHA512Managed");
hashtable.Add("RSA", "System.Security.Cryptography.RSACryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.RSA", "System.Security.Cryptography.RSACryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.AsymmetricAlgorithm", "System.Security.Cryptography.RSACryptoServiceProvider");
hashtable.Add("DSA", "System.Security.Cryptography.DSACryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.DSA", "System.Security.Cryptography.DSACryptoServiceProvider");
hashtable.Add("DES", "System.Security.Cryptography.DESCryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.DES", "System.Security.Cryptography.DESCryptoServiceProvider");
hashtable.Add("3DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
hashtable.Add("TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
hashtable.Add("Triple DES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.TripleDES", "System.Security.Cryptography.TripleDESCryptoServiceProvider");
hashtable.Add("RC2", "System.Security.Cryptography.RC2CryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.RC2", "System.Security.Cryptography.RC2CryptoServiceProvider");
hashtable.Add("Rijndael", "System.Security.Cryptography.RijndaelManaged");
hashtable.Add("System.Security.Cryptography.Rijndael", "System.Security.Cryptography.RijndaelManaged");
hashtable.Add("System.Security.Cryptography.SymmetricAlgorithm", "System.Security.Cryptography.RijndaelManaged");
hashtable.Add("RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.RandomNumberGenerator", "System.Security.Cryptography.RNGCryptoServiceProvider");
hashtable.Add("System.Security.Cryptography.KeyedHashAlgorithm", "System.Security.Cryptography.HMACSHA1");
hashtable.Add("HMACSHA1", "System.Security.Cryptography.HMACSHA1");
hashtable.Add("System.Security.Cryptography.HMACSHA1", "System.Security.Cryptography.HMACSHA1");
hashtable.Add("MACTripleDES", "System.Security.Cryptography.MACTripleDES");
hashtable.Add("System.Security.Cryptography.MACTripleDES", "System.Security.Cryptography.MACTripleDES");
hashtable.Add("RIPEMD160", "System.Security.Cryptography.RIPEMD160Managed");
hashtable.Add("RIPEMD-160", "System.Security.Cryptography.RIPEMD160Managed");
hashtable.Add("System.Security.Cryptography.RIPEMD160", "System.Security.Cryptography.RIPEMD160Managed");
hashtable.Add("System.Security.Cryptography.HMAC", "System.Security.Cryptography.HMACSHA1");
hashtable.Add("HMACMD5", "System.Security.Cryptography.HMACMD5");
hashtable.Add("System.Security.Cryptography.HMACMD5", "System.Security.Cryptography.HMACMD5");
hashtable.Add("HMACRIPEMD160", "System.Security.Cryptography.HMACRIPEMD160");
hashtable.Add("System.Security.Cryptography.HMACRIPEMD160", "System.Security.Cryptography.HMACRIPEMD160");
hashtable.Add("HMACSHA256", "System.Security.Cryptography.HMACSHA256");
hashtable.Add("System.Security.Cryptography.HMACSHA256", "System.Security.Cryptography.HMACSHA256");
hashtable.Add("HMACSHA384", "System.Security.Cryptography.HMACSHA384");
hashtable.Add("System.Security.Cryptography.HMACSHA384", "System.Security.Cryptography.HMACSHA384");
hashtable.Add("HMACSHA512", "System.Security.Cryptography.HMACSHA512");
hashtable.Add("System.Security.Cryptography.HMACSHA512", "System.Security.Cryptography.HMACSHA512");
hashtable.Add("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription");
hashtable.Add("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription");
hashtable.Add("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider");
hashtable.Add("http://www.w3.org/TR/2001/REC-xml-c14n-20010315", "System.Security.Cryptography.Xml.XmlDsigC14NTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", "System.Security.Cryptography.Xml.XmlDsigC14NWithCommentsTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2000/09/xmldsig#base64", "System.Security.Cryptography.Xml.XmlDsigBase64Transform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/TR/1999/REC-xpath-19991116", "System.Security.Cryptography.Xml.XmlDsigXPathTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/TR/1999/REC-xslt-19991116", "System.Security.Cryptography.Xml.XmlDsigXsltTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2000/09/xmldsig#enveloped-signature", "System.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2001/10/xml-exc-c14n#", "System.Security.Cryptography.Xml.XmlDsigExcC14NTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2001/10/xml-exc-c14n#WithComments", "System.Security.Cryptography.Xml.XmlDsigExcC14NWithCommentsTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2002/07/decrypt#XML", "System.Security.Cryptography.Xml.XmlDecryptionTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2001/04/xmlenc#sha256", "System.Security.Cryptography.SHA256Managed");
hashtable.Add("http://www.w3.org/2001/04/xmlenc#sha512", "System.Security.Cryptography.SHA512Managed");
hashtable.Add("http://www.w3.org/2001/04/xmldsig-more#hmac-sha256", "System.Security.Cryptography.HMACSHA256");
hashtable.Add("http://www.w3.org/2001/04/xmldsig-more#hmac-sha384", "System.Security.Cryptography.HMACSHA384");
hashtable.Add("http://www.w3.org/2001/04/xmldsig-more#hmac-sha512", "System.Security.Cryptography.HMACSHA512");
hashtable.Add("http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160", "System.Security.Cryptography.HMACRIPEMD160");
hashtable.Add("http://www.w3.org/2000/09/xmldsig# X509Data", "System.Security.Cryptography.Xml.KeyInfoX509Data, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2000/09/xmldsig# KeyName", "System.Security.Cryptography.Xml.KeyInfoName, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2000/09/xmldsig# KeyValue/DSAKeyValue", "System.Security.Cryptography.Xml.DSAKeyValue, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2000/09/xmldsig# KeyValue/RSAKeyValue", "System.Security.Cryptography.Xml.RSAKeyValue, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("http://www.w3.org/2000/09/xmldsig# RetrievalMethod", "System.Security.Cryptography.Xml.KeyInfoRetrievalMethod, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
hashtable.Add("2.5.29.14", "System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
hashtable.Add("2.5.29.15", "System.Security.Cryptography.X509Certificates.X509KeyUsageExtension, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
hashtable.Add("2.5.29.19", "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
hashtable.Add("2.5.29.37", "System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
hashtable.Add("X509Chain", "System.Security.Cryptography.X509Certificates.X509Chain, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
Hashtable hashtable2 = new Hashtable(new CaseInsensitiveHashCodeProvider(), new CaseInsensitiveComparer());
hashtable2.Add("System.Security.Cryptography.SHA1CryptoServiceProvider", "1.3.14.3.2.26");
hashtable2.Add("System.Security.Cryptography.SHA1Managed", "1.3.14.3.2.26");
hashtable2.Add("SHA1", "1.3.14.3.2.26");
hashtable2.Add("System.Security.Cryptography.SHA1", "1.3.14.3.2.26");
hashtable2.Add("System.Security.Cryptography.MD5CryptoServiceProvider", "1.2.840.113549.2.5");
hashtable2.Add("MD5", "1.2.840.113549.2.5");
hashtable2.Add("System.Security.Cryptography.MD5", "1.2.840.113549.2.5");
hashtable2.Add("System.Security.Cryptography.SHA256Managed", "2.16.840.1.101.3.4.2.1");
hashtable2.Add("SHA256", "2.16.840.1.101.3.4.2.1");
hashtable2.Add("System.Security.Cryptography.SHA256", "2.16.840.1.101.3.4.2.1");
hashtable2.Add("System.Security.Cryptography.SHA384Managed", "2.16.840.1.101.3.4.2.2");
hashtable2.Add("SHA384", "2.16.840.1.101.3.4.2.2");
hashtable2.Add("System.Security.Cryptography.SHA384", "2.16.840.1.101.3.4.2.2");
hashtable2.Add("System.Security.Cryptography.SHA512Managed", "2.16.840.1.101.3.4.2.3");
hashtable2.Add("SHA512", "2.16.840.1.101.3.4.2.3");
hashtable2.Add("System.Security.Cryptography.SHA512", "2.16.840.1.101.3.4.2.3");
hashtable2.Add("TripleDESKeyWrap", "1.2.840.113549.1.9.16.3.6");
hashtable2.Add("DES", "1.3.14.3.2.7");
hashtable2.Add("TripleDES", "1.2.840.113549.3.7");
hashtable2.Add("RC2", "1.2.840.113549.3.2");
CryptoConfig.algorithms = hashtable;
CryptoConfig.oid = hashtable2;
}
// Token: 0x06002EAD RID: 11949 RVA: 0x00095964 File Offset: 0x00093B64
private static void LoadConfig(string filename, Hashtable algorithms, Hashtable oid)
{
if (!File.Exists(filename))
{
return;
}
try
{
using (TextReader textReader = new StreamReader(filename))
{
CryptoConfig.CryptoHandler cryptoHandler = new CryptoConfig.CryptoHandler(algorithms, oid);
SmallXmlParser smallXmlParser = new SmallXmlParser();
smallXmlParser.Parse(textReader, cryptoHandler);
}
}
catch
{
}
}
/// <summary>Creates a new instance of the specified cryptographic object.</summary>
/// <returns>A new instance of the specified cryptographic object.</returns>
/// <param name="name">The simple name of the cryptographic object of which to create an instance. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Reflection.TargetInvocationException">The algorithm described by the <paramref name="name" /> parameter was used with Federal Information Processing Standards (FIPS) mode enabled, but is not FIPS compatible.</exception>
// Token: 0x06002EAE RID: 11950 RVA: 0x000959EC File Offset: 0x00093BEC
public static object CreateFromName(string name)
{
return CryptoConfig.CreateFromName(name, null);
}
/// <summary>Creates a new instance of the specified cryptographic object with the specified arguments.</summary>
/// <returns>A new instance of the specified cryptographic object.</returns>
/// <param name="name">The simple name of the cryptographic object of which to create an instance. </param>
/// <param name="args">The arguments used to create the specified cryptographic object. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
/// <exception cref="T:System.Reflection.TargetInvocationException">The algorithm described by the <paramref name="name" /> parameter was used with Federal Information Processing Standards (FIPS) mode enabled, but is not FIPS compatible.</exception>
// Token: 0x06002EAF RID: 11951 RVA: 0x000959F8 File Offset: 0x00093BF8
public static object CreateFromName(string name, params object[] args)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
object obj = CryptoConfig.lockObject;
lock (obj)
{
if (CryptoConfig.algorithms == null)
{
CryptoConfig.Initialize();
}
}
object obj2;
try
{
string text = (string)CryptoConfig.algorithms[name];
if (text == null)
{
text = name;
}
Type type = Type.GetType(text);
obj2 = Activator.CreateInstance(type, args);
}
catch
{
obj2 = null;
}
return obj2;
}
/// <summary>Gets the object identifier (OID) of the algorithm corresponding to the specified simple name.</summary>
/// <returns>The OID of the specified algorithm.</returns>
/// <param name="name">The simple name of the algorithm for which to get the OID. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="name" /> parameter is null. </exception>
// Token: 0x06002EB0 RID: 11952 RVA: 0x00095AB4 File Offset: 0x00093CB4
public static string MapNameToOID(string name)
{
if (name == null)
{
throw new ArgumentNullException("name");
}
object obj = CryptoConfig.lockObject;
lock (obj)
{
if (CryptoConfig.oid == null)
{
CryptoConfig.Initialize();
}
}
return (string)CryptoConfig.oid[name];
}
/// <summary>Encodes the specified object identifier (OID).</summary>
/// <returns>A byte array containing the encoded OID.</returns>
/// <param name="str">The OID to encode. </param>
/// <exception cref="T:System.ArgumentNullException">The <paramref name="str" /> parameter is null. </exception>
/// <exception cref="T:System.Security.Cryptography.CryptographicUnexpectedOperationException">An error occurred while encoding the OID. </exception>
// Token: 0x06002EB1 RID: 11953 RVA: 0x00095B28 File Offset: 0x00093D28
public static byte[] EncodeOID(string str)
{
if (str == null)
{
throw new ArgumentNullException("str");
}
char[] array = new char[] { '.' };
string[] array2 = str.Split(array);
if (array2.Length < 2)
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("OID must have at least two parts"));
}
byte[] array3 = new byte[str.Length];
try
{
byte b = Convert.ToByte(array2[0]);
byte b2 = Convert.ToByte(array2[1]);
array3[2] = Convert.ToByte((int)(b * 40 + b2));
}
catch
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("Invalid OID"));
}
int num = 3;
for (int i = 2; i < array2.Length; i++)
{
long num2 = Convert.ToInt64(array2[i]);
if (num2 > 127L)
{
byte[] array4 = CryptoConfig.EncodeLongNumber(num2);
Buffer.BlockCopy(array4, 0, array3, num, array4.Length);
num += array4.Length;
}
else
{
array3[num++] = Convert.ToByte(num2);
}
}
int num3 = 2;
byte[] array5 = new byte[num];
array5[0] = 6;
if (num > 127)
{
throw new CryptographicUnexpectedOperationException(Locale.GetText("OID > 127 bytes"));
}
array5[1] = Convert.ToByte(num - 2);
Buffer.BlockCopy(array3, num3, array5, num3, num - num3);
return array5;
}
// Token: 0x06002EB2 RID: 11954 RVA: 0x00095C88 File Offset: 0x00093E88
private static byte[] EncodeLongNumber(long x)
{
if (x > 2147483647L || x < -2147483648L)
{
throw new OverflowException(Locale.GetText("Part of OID doesn't fit in Int32"));
}
long num = x;
int num2 = 1;
while (num > 127L)
{
num >>= 7;
num2++;
}
byte[] array = new byte[num2];
for (int i = 0; i < num2; i++)
{
num = x >> 7 * i;
num &= 127L;
if (i != 0)
{
num += 128L;
}
array[num2 - i - 1] = Convert.ToByte(num);
}
return array;
}
// Token: 0x04001272 RID: 4722
private const string defaultNamespace = "System.Security.Cryptography.";
// Token: 0x04001273 RID: 4723
private const string defaultSHA1 = "System.Security.Cryptography.SHA1CryptoServiceProvider";
// Token: 0x04001274 RID: 4724
private const string defaultMD5 = "System.Security.Cryptography.MD5CryptoServiceProvider";
// Token: 0x04001275 RID: 4725
private const string defaultSHA256 = "System.Security.Cryptography.SHA256Managed";
// Token: 0x04001276 RID: 4726
private const string defaultSHA384 = "System.Security.Cryptography.SHA384Managed";
// Token: 0x04001277 RID: 4727
private const string defaultSHA512 = "System.Security.Cryptography.SHA512Managed";
// Token: 0x04001278 RID: 4728
private const string defaultRSA = "System.Security.Cryptography.RSACryptoServiceProvider";
// Token: 0x04001279 RID: 4729
private const string defaultDSA = "System.Security.Cryptography.DSACryptoServiceProvider";
// Token: 0x0400127A RID: 4730
private const string defaultDES = "System.Security.Cryptography.DESCryptoServiceProvider";
// Token: 0x0400127B RID: 4731
private const string default3DES = "System.Security.Cryptography.TripleDESCryptoServiceProvider";
// Token: 0x0400127C RID: 4732
private const string defaultRC2 = "System.Security.Cryptography.RC2CryptoServiceProvider";
// Token: 0x0400127D RID: 4733
private const string defaultAES = "System.Security.Cryptography.RijndaelManaged";
// Token: 0x0400127E RID: 4734
private const string defaultRNG = "System.Security.Cryptography.RNGCryptoServiceProvider";
// Token: 0x0400127F RID: 4735
private const string defaultHMAC = "System.Security.Cryptography.HMACSHA1";
// Token: 0x04001280 RID: 4736
private const string defaultMAC3DES = "System.Security.Cryptography.MACTripleDES";
// Token: 0x04001281 RID: 4737
private const string defaultDSASigDesc = "System.Security.Cryptography.DSASignatureDescription";
// Token: 0x04001282 RID: 4738
private const string defaultRSASigDesc = "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription";
// Token: 0x04001283 RID: 4739
private const string defaultRIPEMD160 = "System.Security.Cryptography.RIPEMD160Managed";
// Token: 0x04001284 RID: 4740
private const string defaultHMACMD5 = "System.Security.Cryptography.HMACMD5";
// Token: 0x04001285 RID: 4741
private const string defaultHMACRIPEMD160 = "System.Security.Cryptography.HMACRIPEMD160";
// Token: 0x04001286 RID: 4742
private const string defaultHMACSHA256 = "System.Security.Cryptography.HMACSHA256";
// Token: 0x04001287 RID: 4743
private const string defaultHMACSHA384 = "System.Security.Cryptography.HMACSHA384";
// Token: 0x04001288 RID: 4744
private const string defaultHMACSHA512 = "System.Security.Cryptography.HMACSHA512";
// Token: 0x04001289 RID: 4745
private const string defaultC14N = "System.Security.Cryptography.Xml.XmlDsigC14NTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x0400128A RID: 4746
private const string defaultC14NWithComments = "System.Security.Cryptography.Xml.XmlDsigC14NWithCommentsTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x0400128B RID: 4747
private const string defaultBase64 = "System.Security.Cryptography.Xml.XmlDsigBase64Transform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x0400128C RID: 4748
private const string defaultXPath = "System.Security.Cryptography.Xml.XmlDsigXPathTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x0400128D RID: 4749
private const string defaultXslt = "System.Security.Cryptography.Xml.XmlDsigXsltTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x0400128E RID: 4750
private const string defaultEnveloped = "System.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x0400128F RID: 4751
private const string defaultXmlDecryption = "System.Security.Cryptography.Xml.XmlDecryptionTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x04001290 RID: 4752
private const string defaultExcC14N = "System.Security.Cryptography.Xml.XmlDsigExcC14NTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x04001291 RID: 4753
private const string defaultExcC14NWithComments = "System.Security.Cryptography.Xml.XmlDsigExcC14NWithCommentsTransform, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x04001292 RID: 4754
private const string defaultX509Data = "System.Security.Cryptography.Xml.KeyInfoX509Data, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x04001293 RID: 4755
private const string defaultKeyName = "System.Security.Cryptography.Xml.KeyInfoName, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x04001294 RID: 4756
private const string defaultKeyValueDSA = "System.Security.Cryptography.Xml.DSAKeyValue, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x04001295 RID: 4757
private const string defaultKeyValueRSA = "System.Security.Cryptography.Xml.RSAKeyValue, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x04001296 RID: 4758
private const string defaultRetrievalMethod = "System.Security.Cryptography.Xml.KeyInfoRetrievalMethod, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
// Token: 0x04001297 RID: 4759
private const string managedSHA1 = "System.Security.Cryptography.SHA1Managed";
// Token: 0x04001298 RID: 4760
private const string oidSHA1 = "1.3.14.3.2.26";
// Token: 0x04001299 RID: 4761
private const string oidMD5 = "1.2.840.113549.2.5";
// Token: 0x0400129A RID: 4762
private const string oidSHA256 = "2.16.840.1.101.3.4.2.1";
// Token: 0x0400129B RID: 4763
private const string oidSHA384 = "2.16.840.1.101.3.4.2.2";
// Token: 0x0400129C RID: 4764
private const string oidSHA512 = "2.16.840.1.101.3.4.2.3";
// Token: 0x0400129D RID: 4765
private const string oidDSA = "1.2.840.10040.4.1";
// Token: 0x0400129E RID: 4766
private const string oidDES = "1.3.14.3.2.7";
// Token: 0x0400129F RID: 4767
private const string oid3DES = "1.2.840.113549.3.7";
// Token: 0x040012A0 RID: 4768
private const string oidRC2 = "1.2.840.113549.3.2";
// Token: 0x040012A1 RID: 4769
private const string oid3DESKeyWrap = "1.2.840.113549.1.9.16.3.6";
// Token: 0x040012A2 RID: 4770
private const string nameSHA1a = "SHA";
// Token: 0x040012A3 RID: 4771
private const string nameSHA1b = "SHA1";
// Token: 0x040012A4 RID: 4772
private const string nameSHA1c = "System.Security.Cryptography.SHA1";
// Token: 0x040012A5 RID: 4773
private const string nameSHA1d = "System.Security.Cryptography.HashAlgorithm";
// Token: 0x040012A6 RID: 4774
private const string nameMD5a = "MD5";
// Token: 0x040012A7 RID: 4775
private const string nameMD5b = "System.Security.Cryptography.MD5";
// Token: 0x040012A8 RID: 4776
private const string nameSHA256a = "SHA256";
// Token: 0x040012A9 RID: 4777
private const string nameSHA256b = "SHA-256";
// Token: 0x040012AA RID: 4778
private const string nameSHA256c = "System.Security.Cryptography.SHA256";
// Token: 0x040012AB RID: 4779
private const string nameSHA384a = "SHA384";
// Token: 0x040012AC RID: 4780
private const string nameSHA384b = "SHA-384";
// Token: 0x040012AD RID: 4781
private const string nameSHA384c = "System.Security.Cryptography.SHA384";
// Token: 0x040012AE RID: 4782
private const string nameSHA512a = "SHA512";
// Token: 0x040012AF RID: 4783
private const string nameSHA512b = "SHA-512";
// Token: 0x040012B0 RID: 4784
private const string nameSHA512c = "System.Security.Cryptography.SHA512";
// Token: 0x040012B1 RID: 4785
private const string nameRSAa = "RSA";
// Token: 0x040012B2 RID: 4786
private const string nameRSAb = "System.Security.Cryptography.RSA";
// Token: 0x040012B3 RID: 4787
private const string nameRSAc = "System.Security.Cryptography.AsymmetricAlgorithm";
// Token: 0x040012B4 RID: 4788
private const string nameDSAa = "DSA";
// Token: 0x040012B5 RID: 4789
private const string nameDSAb = "System.Security.Cryptography.DSA";
// Token: 0x040012B6 RID: 4790
private const string nameDESa = "DES";
// Token: 0x040012B7 RID: 4791
private const string nameDESb = "System.Security.Cryptography.DES";
// Token: 0x040012B8 RID: 4792
private const string name3DESa = "3DES";
// Token: 0x040012B9 RID: 4793
private const string name3DESb = "TripleDES";
// Token: 0x040012BA RID: 4794
private const string name3DESc = "Triple DES";
// Token: 0x040012BB RID: 4795
private const string name3DESd = "System.Security.Cryptography.TripleDES";
// Token: 0x040012BC RID: 4796
private const string nameRC2a = "RC2";
// Token: 0x040012BD RID: 4797
private const string nameRC2b = "System.Security.Cryptography.RC2";
// Token: 0x040012BE RID: 4798
private const string nameAESa = "Rijndael";
// Token: 0x040012BF RID: 4799
private const string nameAESb = "System.Security.Cryptography.Rijndael";
// Token: 0x040012C0 RID: 4800
private const string nameAESc = "System.Security.Cryptography.SymmetricAlgorithm";
// Token: 0x040012C1 RID: 4801
private const string nameRNGa = "RandomNumberGenerator";
// Token: 0x040012C2 RID: 4802
private const string nameRNGb = "System.Security.Cryptography.RandomNumberGenerator";
// Token: 0x040012C3 RID: 4803
private const string nameKeyHasha = "System.Security.Cryptography.KeyedHashAlgorithm";
// Token: 0x040012C4 RID: 4804
private const string nameHMACSHA1a = "HMACSHA1";
// Token: 0x040012C5 RID: 4805
private const string nameHMACSHA1b = "System.Security.Cryptography.HMACSHA1";
// Token: 0x040012C6 RID: 4806
private const string nameMAC3DESa = "MACTripleDES";
// Token: 0x040012C7 RID: 4807
private const string nameMAC3DESb = "System.Security.Cryptography.MACTripleDES";
// Token: 0x040012C8 RID: 4808
private const string name3DESKeyWrap = "TripleDESKeyWrap";
// Token: 0x040012C9 RID: 4809
private const string nameRIPEMD160a = "RIPEMD160";
// Token: 0x040012CA RID: 4810
private const string nameRIPEMD160b = "RIPEMD-160";
// Token: 0x040012CB RID: 4811
private const string nameRIPEMD160c = "System.Security.Cryptography.RIPEMD160";
// Token: 0x040012CC RID: 4812
private const string nameHMACa = "HMAC";
// Token: 0x040012CD RID: 4813
private const string nameHMACb = "System.Security.Cryptography.HMAC";
// Token: 0x040012CE RID: 4814
private const string nameHMACMD5a = "HMACMD5";
// Token: 0x040012CF RID: 4815
private const string nameHMACMD5b = "System.Security.Cryptography.HMACMD5";
// Token: 0x040012D0 RID: 4816
private const string nameHMACRIPEMD160a = "HMACRIPEMD160";
// Token: 0x040012D1 RID: 4817
private const string nameHMACRIPEMD160b = "System.Security.Cryptography.HMACRIPEMD160";
// Token: 0x040012D2 RID: 4818
private const string nameHMACSHA256a = "HMACSHA256";
// Token: 0x040012D3 RID: 4819
private const string nameHMACSHA256b = "System.Security.Cryptography.HMACSHA256";
// Token: 0x040012D4 RID: 4820
private const string nameHMACSHA384a = "HMACSHA384";
// Token: 0x040012D5 RID: 4821
private const string nameHMACSHA384b = "System.Security.Cryptography.HMACSHA384";
// Token: 0x040012D6 RID: 4822
private const string nameHMACSHA512a = "HMACSHA512";
// Token: 0x040012D7 RID: 4823
private const string nameHMACSHA512b = "System.Security.Cryptography.HMACSHA512";
// Token: 0x040012D8 RID: 4824
private const string urlXmlDsig = "http://www.w3.org/2000/09/xmldsig#";
// Token: 0x040012D9 RID: 4825
private const string urlDSASHA1 = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
// Token: 0x040012DA RID: 4826
private const string urlRSASHA1 = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
// Token: 0x040012DB RID: 4827
private const string urlSHA1 = "http://www.w3.org/2000/09/xmldsig#sha1";
// Token: 0x040012DC RID: 4828
private const string urlC14N = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
// Token: 0x040012DD RID: 4829
private const string urlC14NWithComments = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
// Token: 0x040012DE RID: 4830
private const string urlBase64 = "http://www.w3.org/2000/09/xmldsig#base64";
// Token: 0x040012DF RID: 4831
private const string urlXPath = "http://www.w3.org/TR/1999/REC-xpath-19991116";
// Token: 0x040012E0 RID: 4832
private const string urlXslt = "http://www.w3.org/TR/1999/REC-xslt-19991116";
// Token: 0x040012E1 RID: 4833
private const string urlEnveloped = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
// Token: 0x040012E2 RID: 4834
private const string urlXmlDecryption = "http://www.w3.org/2002/07/decrypt#XML";
// Token: 0x040012E3 RID: 4835
private const string urlExcC14NWithComments = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
// Token: 0x040012E4 RID: 4836
private const string urlExcC14N = "http://www.w3.org/2001/10/xml-exc-c14n#";
// Token: 0x040012E5 RID: 4837
private const string urlSHA256 = "http://www.w3.org/2001/04/xmlenc#sha256";
// Token: 0x040012E6 RID: 4838
private const string urlSHA512 = "http://www.w3.org/2001/04/xmlenc#sha512";
// Token: 0x040012E7 RID: 4839
private const string urlHMACSHA256 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256";
// Token: 0x040012E8 RID: 4840
private const string urlHMACSHA384 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384";
// Token: 0x040012E9 RID: 4841
private const string urlHMACSHA512 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512";
// Token: 0x040012EA RID: 4842
private const string urlHMACRIPEMD160 = "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160";
// Token: 0x040012EB RID: 4843
private const string urlX509Data = "http://www.w3.org/2000/09/xmldsig# X509Data";
// Token: 0x040012EC RID: 4844
private const string urlKeyName = "http://www.w3.org/2000/09/xmldsig# KeyName";
// Token: 0x040012ED RID: 4845
private const string urlKeyValueDSA = "http://www.w3.org/2000/09/xmldsig# KeyValue/DSAKeyValue";
// Token: 0x040012EE RID: 4846
private const string urlKeyValueRSA = "http://www.w3.org/2000/09/xmldsig# KeyValue/RSAKeyValue";
// Token: 0x040012EF RID: 4847
private const string urlRetrievalMethod = "http://www.w3.org/2000/09/xmldsig# RetrievalMethod";
// Token: 0x040012F0 RID: 4848
private const string oidX509SubjectKeyIdentifier = "2.5.29.14";
// Token: 0x040012F1 RID: 4849
private const string oidX509KeyUsage = "2.5.29.15";
// Token: 0x040012F2 RID: 4850
private const string oidX509BasicConstraints = "2.5.29.19";
// Token: 0x040012F3 RID: 4851
private const string oidX509EnhancedKeyUsage = "2.5.29.37";
// Token: 0x040012F4 RID: 4852
private const string nameX509SubjectKeyIdentifier = "System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
// Token: 0x040012F5 RID: 4853
private const string nameX509KeyUsage = "System.Security.Cryptography.X509Certificates.X509KeyUsageExtension, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
// Token: 0x040012F6 RID: 4854
private const string nameX509BasicConstraints = "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
// Token: 0x040012F7 RID: 4855
private const string nameX509EnhancedKeyUsage = "System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
// Token: 0x040012F8 RID: 4856
private const string nameX509Chain = "X509Chain";
// Token: 0x040012F9 RID: 4857
private const string defaultX509Chain = "System.Security.Cryptography.X509Certificates.X509Chain, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
// Token: 0x040012FA RID: 4858
private static object lockObject = new object();
// Token: 0x040012FB RID: 4859
private static Hashtable algorithms;
// Token: 0x040012FC RID: 4860
private static Hashtable oid;
// Token: 0x020004EE RID: 1262
private class CryptoHandler : SmallXmlParser.IContentHandler
{
// Token: 0x06002EB3 RID: 11955 RVA: 0x00095D1C File Offset: 0x00093F1C
public CryptoHandler(Hashtable algorithms, Hashtable oid)
{
this.algorithms = algorithms;
this.oid = oid;
this.names = new Hashtable();
this.classnames = new Hashtable();
}
// Token: 0x06002EB4 RID: 11956 RVA: 0x00095D54 File Offset: 0x00093F54
public void OnStartParsing(SmallXmlParser parser)
{
}
// Token: 0x06002EB5 RID: 11957 RVA: 0x00095D58 File Offset: 0x00093F58
public void OnEndParsing(SmallXmlParser parser)
{
foreach (object obj in this.names)
{
DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
try
{
this.algorithms.Add(dictionaryEntry.Key, this.classnames[dictionaryEntry.Value]);
}
catch
{
}
}
this.names.Clear();
this.classnames.Clear();
}
// Token: 0x06002EB6 RID: 11958 RVA: 0x00095E20 File Offset: 0x00094020
private string Get(SmallXmlParser.IAttrList attrs, string name)
{
for (int i = 0; i < attrs.Names.Length; i++)
{
if (attrs.Names[i] == name)
{
return attrs.Values[i];
}
}
return string.Empty;
}
// Token: 0x06002EB7 RID: 11959 RVA: 0x00095E68 File Offset: 0x00094068
public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
{
switch (this.level)
{
case 0:
if (name == "configuration")
{
this.level++;
}
break;
case 1:
if (name == "mscorlib")
{
this.level++;
}
break;
case 2:
if (name == "cryptographySettings")
{
this.level++;
}
break;
case 3:
if (name == "oidMap")
{
this.level++;
}
else if (name == "cryptoNameMapping")
{
this.level++;
}
break;
case 4:
if (name == "oidEntry")
{
this.oid.Add(this.Get(attrs, "name"), this.Get(attrs, "OID"));
}
else if (name == "nameEntry")
{
this.names.Add(this.Get(attrs, "name"), this.Get(attrs, "class"));
}
else if (name == "cryptoClasses")
{
this.level++;
}
break;
case 5:
if (name == "cryptoClass")
{
this.classnames.Add(attrs.Names[0], attrs.Values[0]);
}
break;
}
}
// Token: 0x06002EB8 RID: 11960 RVA: 0x00096014 File Offset: 0x00094214
public void OnEndElement(string name)
{
switch (this.level)
{
case 1:
if (name == "configuration")
{
this.level--;
}
break;
case 2:
if (name == "mscorlib")
{
this.level--;
}
break;
case 3:
if (name == "cryptographySettings")
{
this.level--;
}
break;
case 4:
if (name == "oidMap" || name == "cryptoNameMapping")
{
this.level--;
}
break;
case 5:
if (name == "cryptoClasses")
{
this.level--;
}
break;
}
}
// Token: 0x06002EB9 RID: 11961 RVA: 0x00096108 File Offset: 0x00094308
public void OnProcessingInstruction(string name, string text)
{
}
// Token: 0x06002EBA RID: 11962 RVA: 0x0009610C File Offset: 0x0009430C
public void OnChars(string text)
{
}
// Token: 0x06002EBB RID: 11963 RVA: 0x00096110 File Offset: 0x00094310
public void OnIgnorableWhitespace(string text)
{
}
// Token: 0x040012FD RID: 4861
private Hashtable algorithms;
// Token: 0x040012FE RID: 4862
private Hashtable oid;
// Token: 0x040012FF RID: 4863
private Hashtable names;
// Token: 0x04001300 RID: 4864
private Hashtable classnames;
// Token: 0x04001301 RID: 4865
private int level;
}
}
}