This commit is contained in:
niko
2026-06-04 11:42:34 +02:00
parent f39ba70a9f
commit e720b98cd1
7488 changed files with 2493818 additions and 0 deletions
+2347
View File
@@ -0,0 +1,2347 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Mono.Security.Cryptography;
namespace Mono.Security.X509
{
// Token: 0x020000B6 RID: 182
internal class PKCS12 : ICloneable
{
// Token: 0x060009B5 RID: 2485 RVA: 0x00027FB8 File Offset: 0x000261B8
public PKCS12()
{
this._iterations = PKCS12.recommendedIterationCount;
this._keyBags = new ArrayList();
this._secretBags = new ArrayList();
this._certs = new X509CertificateCollection();
this._keyBagsChanged = false;
this._secretBagsChanged = false;
this._certsChanged = false;
this._safeBags = new ArrayList();
}
// Token: 0x060009B6 RID: 2486 RVA: 0x00028018 File Offset: 0x00026218
public PKCS12(byte[] data)
: this()
{
this.Password = null;
this.Decode(data);
}
// Token: 0x060009B7 RID: 2487 RVA: 0x00028030 File Offset: 0x00026230
public PKCS12(byte[] data, string password)
: this()
{
this.Password = password;
this.Decode(data);
}
// Token: 0x060009B8 RID: 2488 RVA: 0x00028048 File Offset: 0x00026248
public PKCS12(byte[] data, byte[] password)
: this()
{
this._password = password;
this.Decode(data);
}
// Token: 0x060009BA RID: 2490 RVA: 0x00028078 File Offset: 0x00026278
private void Decode(byte[] data)
{
ASN1 asn = new ASN1(data);
if (asn.Tag != 48)
{
throw new ArgumentException("invalid data");
}
ASN1 asn2 = asn[0];
if (asn2.Tag != 2)
{
throw new ArgumentException("invalid PFX version");
}
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo(asn[1]);
if (contentInfo.ContentType != "1.2.840.113549.1.7.1")
{
throw new ArgumentException("invalid authenticated safe");
}
if (asn.Count > 2)
{
ASN1 asn3 = asn[2];
if (asn3.Tag != 48)
{
throw new ArgumentException("invalid MAC");
}
ASN1 asn4 = asn3[0];
if (asn4.Tag != 48)
{
throw new ArgumentException("invalid MAC");
}
ASN1 asn5 = asn4[0];
string text = ASN1Convert.ToOid(asn5[0]);
if (text != "1.3.14.3.2.26")
{
throw new ArgumentException("unsupported HMAC");
}
byte[] value = asn4[1].Value;
ASN1 asn6 = asn3[1];
if (asn6.Tag != 4)
{
throw new ArgumentException("missing MAC salt");
}
this._iterations = 1;
if (asn3.Count > 2)
{
ASN1 asn7 = asn3[2];
if (asn7.Tag != 2)
{
throw new ArgumentException("invalid MAC iteration");
}
this._iterations = ASN1Convert.ToInt32(asn7);
}
byte[] value2 = contentInfo.Content[0].Value;
byte[] array = this.MAC(this._password, asn6.Value, this._iterations, value2);
if (!this.Compare(value, array))
{
throw new CryptographicException("Invalid MAC - file may have been tampered!");
}
}
ASN1 asn8 = new ASN1(contentInfo.Content[0].Value);
int i = 0;
while (i < asn8.Count)
{
PKCS7.ContentInfo contentInfo2 = new PKCS7.ContentInfo(asn8[i]);
string contentType = contentInfo2.ContentType;
if (contentType != null)
{
if (PKCS12.<>f__switch$map8 == null)
{
PKCS12.<>f__switch$map8 = new Dictionary<string, int>(3)
{
{ "1.2.840.113549.1.7.1", 0 },
{ "1.2.840.113549.1.7.6", 1 },
{ "1.2.840.113549.1.7.3", 2 }
};
}
int num;
if (PKCS12.<>f__switch$map8.TryGetValue(contentType, out num))
{
switch (num)
{
case 0:
{
ASN1 asn9 = new ASN1(contentInfo2.Content[0].Value);
for (int j = 0; j < asn9.Count; j++)
{
ASN1 asn10 = asn9[j];
this.ReadSafeBag(asn10);
}
break;
}
case 1:
{
PKCS7.EncryptedData encryptedData = new PKCS7.EncryptedData(contentInfo2.Content[0]);
ASN1 asn11 = new ASN1(this.Decrypt(encryptedData));
for (int k = 0; k < asn11.Count; k++)
{
ASN1 asn12 = asn11[k];
this.ReadSafeBag(asn12);
}
break;
}
case 2:
throw new NotImplementedException("public key encrypted");
default:
goto IL_303;
}
i++;
continue;
}
}
IL_303:
throw new ArgumentException("unknown authenticatedSafe");
}
}
// Token: 0x060009BB RID: 2491 RVA: 0x000283A8 File Offset: 0x000265A8
~PKCS12()
{
if (this._password != null)
{
Array.Clear(this._password, 0, this._password.Length);
}
this._password = null;
}
// Token: 0x1700011F RID: 287
// (set) Token: 0x060009BC RID: 2492 RVA: 0x00028404 File Offset: 0x00026604
public string Password
{
set
{
if (value != null)
{
if (value.Length > 0)
{
int num = value.Length;
int num2 = 0;
if (num < PKCS12.MaximumPasswordLength)
{
if (value[num - 1] != '\0')
{
num2 = 1;
}
}
else
{
num = PKCS12.MaximumPasswordLength;
}
this._password = new byte[num + num2 << 1];
Encoding.BigEndianUnicode.GetBytes(value, 0, num, this._password, 0);
}
else
{
this._password = new byte[2];
}
}
else
{
this._password = null;
}
}
}
// Token: 0x17000120 RID: 288
// (get) Token: 0x060009BD RID: 2493 RVA: 0x00028494 File Offset: 0x00026694
// (set) Token: 0x060009BE RID: 2494 RVA: 0x0002849C File Offset: 0x0002669C
public int IterationCount
{
get
{
return this._iterations;
}
set
{
this._iterations = value;
}
}
// Token: 0x17000121 RID: 289
// (get) Token: 0x060009BF RID: 2495 RVA: 0x000284A8 File Offset: 0x000266A8
public ArrayList Keys
{
get
{
if (this._keyBagsChanged)
{
this._keyBags.Clear();
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.1"))
{
ASN1 asn = safeBag.ASN1;
ASN1 asn2 = asn[1];
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo(asn2.Value);
byte[] privateKey = privateKeyInfo.PrivateKey;
byte b = privateKey[0];
if (b != 2)
{
if (b == 48)
{
this._keyBags.Add(PKCS8.PrivateKeyInfo.DecodeRSA(privateKey));
}
}
else
{
DSAParameters dsaparameters = default(DSAParameters);
this._keyBags.Add(PKCS8.PrivateKeyInfo.DecodeDSA(privateKey, dsaparameters));
}
Array.Clear(privateKey, 0, privateKey.Length);
}
else if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.2"))
{
ASN1 asn3 = safeBag.ASN1;
ASN1 asn4 = asn3[1];
PKCS8.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = new PKCS8.EncryptedPrivateKeyInfo(asn4.Value);
byte[] array = this.Decrypt(encryptedPrivateKeyInfo.Algorithm, encryptedPrivateKeyInfo.Salt, encryptedPrivateKeyInfo.IterationCount, encryptedPrivateKeyInfo.EncryptedData);
PKCS8.PrivateKeyInfo privateKeyInfo2 = new PKCS8.PrivateKeyInfo(array);
byte[] privateKey2 = privateKeyInfo2.PrivateKey;
byte b = privateKey2[0];
if (b != 2)
{
if (b == 48)
{
this._keyBags.Add(PKCS8.PrivateKeyInfo.DecodeRSA(privateKey2));
}
}
else
{
DSAParameters dsaparameters2 = default(DSAParameters);
this._keyBags.Add(PKCS8.PrivateKeyInfo.DecodeDSA(privateKey2, dsaparameters2));
}
Array.Clear(privateKey2, 0, privateKey2.Length);
Array.Clear(array, 0, array.Length);
}
}
this._keyBagsChanged = false;
}
return ArrayList.ReadOnly(this._keyBags);
}
}
// Token: 0x17000122 RID: 290
// (get) Token: 0x060009C0 RID: 2496 RVA: 0x000286C0 File Offset: 0x000268C0
public ArrayList Secrets
{
get
{
if (this._secretBagsChanged)
{
this._secretBags.Clear();
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.5"))
{
ASN1 asn = safeBag.ASN1;
ASN1 asn2 = asn[1];
byte[] value = asn2.Value;
this._secretBags.Add(value);
}
}
this._secretBagsChanged = false;
}
return ArrayList.ReadOnly(this._secretBags);
}
}
// Token: 0x17000123 RID: 291
// (get) Token: 0x060009C1 RID: 2497 RVA: 0x00028790 File Offset: 0x00026990
public X509CertificateCollection Certificates
{
get
{
if (this._certsChanged)
{
this._certs.Clear();
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.3"))
{
ASN1 asn = safeBag.ASN1;
ASN1 asn2 = asn[1];
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo(asn2.Value);
this._certs.Add(new X509Certificate(contentInfo.Content[0].Value));
}
}
this._certsChanged = false;
}
return this._certs;
}
}
// Token: 0x17000124 RID: 292
// (get) Token: 0x060009C2 RID: 2498 RVA: 0x00028874 File Offset: 0x00026A74
internal RandomNumberGenerator RNG
{
get
{
if (this._rng == null)
{
this._rng = RandomNumberGenerator.Create();
}
return this._rng;
}
}
// Token: 0x060009C3 RID: 2499 RVA: 0x00028894 File Offset: 0x00026A94
private bool Compare(byte[] expected, byte[] actual)
{
bool flag = false;
if (expected.Length == actual.Length)
{
for (int i = 0; i < expected.Length; i++)
{
if (expected[i] != actual[i])
{
return false;
}
}
flag = true;
}
return flag;
}
// Token: 0x060009C4 RID: 2500 RVA: 0x000288D4 File Offset: 0x00026AD4
private SymmetricAlgorithm GetSymmetricAlgorithm(string algorithmOid, byte[] salt, int iterationCount)
{
string text = null;
int num = 8;
int num2 = 8;
PKCS12.DeriveBytes deriveBytes = new PKCS12.DeriveBytes();
deriveBytes.Password = this._password;
deriveBytes.Salt = salt;
deriveBytes.IterationCount = iterationCount;
if (algorithmOid != null)
{
if (PKCS12.<>f__switch$map9 == null)
{
PKCS12.<>f__switch$map9 = new Dictionary<string, int>(12)
{
{ "1.2.840.113549.1.5.1", 0 },
{ "1.2.840.113549.1.5.3", 1 },
{ "1.2.840.113549.1.5.4", 2 },
{ "1.2.840.113549.1.5.6", 3 },
{ "1.2.840.113549.1.5.10", 4 },
{ "1.2.840.113549.1.5.11", 5 },
{ "1.2.840.113549.1.12.1.1", 6 },
{ "1.2.840.113549.1.12.1.2", 7 },
{ "1.2.840.113549.1.12.1.3", 8 },
{ "1.2.840.113549.1.12.1.4", 9 },
{ "1.2.840.113549.1.12.1.5", 10 },
{ "1.2.840.113549.1.12.1.6", 11 }
};
}
int num3;
if (PKCS12.<>f__switch$map9.TryGetValue(algorithmOid, out num3))
{
switch (num3)
{
case 0:
deriveBytes.HashName = "MD2";
text = "DES";
break;
case 1:
deriveBytes.HashName = "MD5";
text = "DES";
break;
case 2:
deriveBytes.HashName = "MD2";
text = "RC2";
num = 4;
break;
case 3:
deriveBytes.HashName = "MD5";
text = "RC2";
num = 4;
break;
case 4:
deriveBytes.HashName = "SHA1";
text = "DES";
break;
case 5:
deriveBytes.HashName = "SHA1";
text = "RC2";
num = 4;
break;
case 6:
deriveBytes.HashName = "SHA1";
text = "RC4";
num = 16;
num2 = 0;
break;
case 7:
deriveBytes.HashName = "SHA1";
text = "RC4";
num = 5;
num2 = 0;
break;
case 8:
deriveBytes.HashName = "SHA1";
text = "TripleDES";
num = 24;
break;
case 9:
deriveBytes.HashName = "SHA1";
text = "TripleDES";
num = 16;
break;
case 10:
deriveBytes.HashName = "SHA1";
text = "RC2";
num = 16;
break;
case 11:
deriveBytes.HashName = "SHA1";
text = "RC2";
num = 5;
break;
default:
goto IL_25A;
}
SymmetricAlgorithm symmetricAlgorithm = SymmetricAlgorithm.Create(text);
symmetricAlgorithm.Key = deriveBytes.DeriveKey(num);
if (num2 > 0)
{
symmetricAlgorithm.IV = deriveBytes.DeriveIV(num2);
symmetricAlgorithm.Mode = CipherMode.CBC;
}
return symmetricAlgorithm;
}
}
IL_25A:
throw new NotSupportedException("unknown oid " + text);
}
// Token: 0x060009C5 RID: 2501 RVA: 0x00028B84 File Offset: 0x00026D84
public byte[] Decrypt(string algorithmOid, byte[] salt, int iterationCount, byte[] encryptedData)
{
SymmetricAlgorithm symmetricAlgorithm = null;
byte[] array = null;
try
{
symmetricAlgorithm = this.GetSymmetricAlgorithm(algorithmOid, salt, iterationCount);
ICryptoTransform cryptoTransform = symmetricAlgorithm.CreateDecryptor();
array = cryptoTransform.TransformFinalBlock(encryptedData, 0, encryptedData.Length);
}
finally
{
if (symmetricAlgorithm != null)
{
symmetricAlgorithm.Clear();
}
}
return array;
}
// Token: 0x060009C6 RID: 2502 RVA: 0x00028BE4 File Offset: 0x00026DE4
public byte[] Decrypt(PKCS7.EncryptedData ed)
{
return this.Decrypt(ed.EncryptionAlgorithm.ContentType, ed.EncryptionAlgorithm.Content[0].Value, ASN1Convert.ToInt32(ed.EncryptionAlgorithm.Content[1]), ed.EncryptedContent);
}
// Token: 0x060009C7 RID: 2503 RVA: 0x00028C34 File Offset: 0x00026E34
public byte[] Encrypt(string algorithmOid, byte[] salt, int iterationCount, byte[] data)
{
byte[] array = null;
using (SymmetricAlgorithm symmetricAlgorithm = this.GetSymmetricAlgorithm(algorithmOid, salt, iterationCount))
{
ICryptoTransform cryptoTransform = symmetricAlgorithm.CreateEncryptor();
array = cryptoTransform.TransformFinalBlock(data, 0, data.Length);
}
return array;
}
// Token: 0x060009C8 RID: 2504 RVA: 0x00028C94 File Offset: 0x00026E94
private DSAParameters GetExistingParameters(out bool found)
{
foreach (X509Certificate x509Certificate in this.Certificates)
{
if (x509Certificate.KeyAlgorithmParameters != null)
{
DSA dsa = x509Certificate.DSA;
if (dsa != null)
{
found = true;
return dsa.ExportParameters(false);
}
}
}
found = false;
return default(DSAParameters);
}
// Token: 0x060009C9 RID: 2505 RVA: 0x00028D34 File Offset: 0x00026F34
private void AddPrivateKey(PKCS8.PrivateKeyInfo pki)
{
byte[] privateKey = pki.PrivateKey;
byte b = privateKey[0];
if (b != 2)
{
if (b != 48)
{
Array.Clear(privateKey, 0, privateKey.Length);
throw new CryptographicException("Unknown private key format");
}
this._keyBags.Add(PKCS8.PrivateKeyInfo.DecodeRSA(privateKey));
}
else
{
bool flag;
DSAParameters existingParameters = this.GetExistingParameters(out flag);
if (flag)
{
this._keyBags.Add(PKCS8.PrivateKeyInfo.DecodeDSA(privateKey, existingParameters));
}
}
Array.Clear(privateKey, 0, privateKey.Length);
}
// Token: 0x060009CA RID: 2506 RVA: 0x00028DC0 File Offset: 0x00026FC0
private void ReadSafeBag(ASN1 safeBag)
{
if (safeBag.Tag != 48)
{
throw new ArgumentException("invalid safeBag");
}
ASN1 asn = safeBag[0];
if (asn.Tag != 6)
{
throw new ArgumentException("invalid safeBag id");
}
ASN1 asn2 = safeBag[1];
string text = ASN1Convert.ToOid(asn);
string text2 = text;
if (text2 != null)
{
if (PKCS12.<>f__switch$mapA == null)
{
PKCS12.<>f__switch$mapA = new Dictionary<string, int>(6)
{
{ "1.2.840.113549.1.12.10.1.1", 0 },
{ "1.2.840.113549.1.12.10.1.2", 1 },
{ "1.2.840.113549.1.12.10.1.3", 2 },
{ "1.2.840.113549.1.12.10.1.4", 3 },
{ "1.2.840.113549.1.12.10.1.5", 4 },
{ "1.2.840.113549.1.12.10.1.6", 5 }
};
}
int num;
if (PKCS12.<>f__switch$mapA.TryGetValue(text2, out num))
{
switch (num)
{
case 0:
this.AddPrivateKey(new PKCS8.PrivateKeyInfo(asn2.Value));
break;
case 1:
{
PKCS8.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = new PKCS8.EncryptedPrivateKeyInfo(asn2.Value);
byte[] array = this.Decrypt(encryptedPrivateKeyInfo.Algorithm, encryptedPrivateKeyInfo.Salt, encryptedPrivateKeyInfo.IterationCount, encryptedPrivateKeyInfo.EncryptedData);
this.AddPrivateKey(new PKCS8.PrivateKeyInfo(array));
Array.Clear(array, 0, array.Length);
break;
}
case 2:
{
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo(asn2.Value);
if (contentInfo.ContentType != "1.2.840.113549.1.9.22.1")
{
throw new NotSupportedException("unsupport certificate type");
}
X509Certificate x509Certificate = new X509Certificate(contentInfo.Content[0].Value);
this._certs.Add(x509Certificate);
break;
}
case 3:
break;
case 4:
{
byte[] value = asn2.Value;
this._secretBags.Add(value);
break;
}
case 5:
break;
default:
goto IL_1CD;
}
if (safeBag.Count > 2)
{
ASN1 asn3 = safeBag[2];
if (asn3.Tag != 49)
{
throw new ArgumentException("invalid safeBag attributes id");
}
for (int i = 0; i < asn3.Count; i++)
{
ASN1 asn4 = asn3[i];
if (asn4.Tag != 48)
{
throw new ArgumentException("invalid PKCS12 attributes id");
}
ASN1 asn5 = asn4[0];
if (asn5.Tag != 6)
{
throw new ArgumentException("invalid attribute id");
}
string text3 = ASN1Convert.ToOid(asn5);
ASN1 asn6 = asn4[1];
int j = 0;
while (j < asn6.Count)
{
ASN1 asn7 = asn6[j];
text2 = text3;
if (text2 != null)
{
if (PKCS12.<>f__switch$mapB == null)
{
PKCS12.<>f__switch$mapB = new Dictionary<string, int>(2)
{
{ "1.2.840.113549.1.9.20", 0 },
{ "1.2.840.113549.1.9.21", 1 }
};
}
if (PKCS12.<>f__switch$mapB.TryGetValue(text2, out num))
{
if (num != 0)
{
if (num == 1)
{
if (asn7.Tag != 4)
{
throw new ArgumentException("invalid attribute value id");
}
}
}
else if (asn7.Tag != 30)
{
throw new ArgumentException("invalid attribute value id");
}
}
}
IL_31F:
j++;
continue;
goto IL_31F;
}
}
}
this._safeBags.Add(new SafeBag(text, safeBag));
return;
}
}
IL_1CD:
throw new ArgumentException("unknown safeBag oid");
}
// Token: 0x060009CB RID: 2507 RVA: 0x00029128 File Offset: 0x00027328
private ASN1 Pkcs8ShroudedKeyBagSafeBag(AsymmetricAlgorithm aa, IDictionary attributes)
{
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo();
if (aa is RSA)
{
privateKeyInfo.Algorithm = "1.2.840.113549.1.1.1";
privateKeyInfo.PrivateKey = PKCS8.PrivateKeyInfo.Encode((RSA)aa);
}
else
{
if (!(aa is DSA))
{
throw new CryptographicException("Unknown asymmetric algorithm {0}", aa.ToString());
}
privateKeyInfo.Algorithm = null;
privateKeyInfo.PrivateKey = PKCS8.PrivateKeyInfo.Encode((DSA)aa);
}
PKCS8.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = new PKCS8.EncryptedPrivateKeyInfo();
encryptedPrivateKeyInfo.Algorithm = "1.2.840.113549.1.12.1.3";
encryptedPrivateKeyInfo.IterationCount = this._iterations;
encryptedPrivateKeyInfo.EncryptedData = this.Encrypt("1.2.840.113549.1.12.1.3", encryptedPrivateKeyInfo.Salt, this._iterations, privateKeyInfo.GetBytes());
ASN1 asn = new ASN1(48);
asn.Add(ASN1Convert.FromOid("1.2.840.113549.1.12.10.1.2"));
ASN1 asn2 = new ASN1(160);
asn2.Add(new ASN1(encryptedPrivateKeyInfo.GetBytes()));
asn.Add(asn2);
if (attributes != null)
{
ASN1 asn3 = new ASN1(49);
IDictionaryEnumerator enumerator = attributes.GetEnumerator();
while (enumerator.MoveNext())
{
string text = (string)enumerator.Key;
string text2 = text;
if (text2 != null)
{
if (PKCS12.<>f__switch$mapC == null)
{
PKCS12.<>f__switch$mapC = new Dictionary<string, int>(2)
{
{ "1.2.840.113549.1.9.20", 0 },
{ "1.2.840.113549.1.9.21", 1 }
};
}
int num;
if (PKCS12.<>f__switch$mapC.TryGetValue(text2, out num))
{
if (num != 0)
{
if (num == 1)
{
ArrayList arrayList = (ArrayList)enumerator.Value;
if (arrayList.Count > 0)
{
ASN1 asn4 = new ASN1(48);
asn4.Add(ASN1Convert.FromOid("1.2.840.113549.1.9.21"));
ASN1 asn5 = new ASN1(49);
foreach (object obj in arrayList)
{
byte[] array = (byte[])obj;
asn5.Add(new ASN1(4)
{
Value = array
});
}
asn4.Add(asn5);
asn3.Add(asn4);
}
}
}
else
{
ArrayList arrayList2 = (ArrayList)enumerator.Value;
if (arrayList2.Count > 0)
{
ASN1 asn6 = new ASN1(48);
asn6.Add(ASN1Convert.FromOid("1.2.840.113549.1.9.20"));
ASN1 asn7 = new ASN1(49);
foreach (object obj2 in arrayList2)
{
byte[] array2 = (byte[])obj2;
asn7.Add(new ASN1(30)
{
Value = array2
});
}
asn6.Add(asn7);
asn3.Add(asn6);
}
}
}
}
}
if (asn3.Count > 0)
{
asn.Add(asn3);
}
}
return asn;
}
// Token: 0x060009CC RID: 2508 RVA: 0x00029478 File Offset: 0x00027678
private ASN1 KeyBagSafeBag(AsymmetricAlgorithm aa, IDictionary attributes)
{
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo();
if (aa is RSA)
{
privateKeyInfo.Algorithm = "1.2.840.113549.1.1.1";
privateKeyInfo.PrivateKey = PKCS8.PrivateKeyInfo.Encode((RSA)aa);
}
else
{
if (!(aa is DSA))
{
throw new CryptographicException("Unknown asymmetric algorithm {0}", aa.ToString());
}
privateKeyInfo.Algorithm = null;
privateKeyInfo.PrivateKey = PKCS8.PrivateKeyInfo.Encode((DSA)aa);
}
ASN1 asn = new ASN1(48);
asn.Add(ASN1Convert.FromOid("1.2.840.113549.1.12.10.1.1"));
ASN1 asn2 = new ASN1(160);
asn2.Add(new ASN1(privateKeyInfo.GetBytes()));
asn.Add(asn2);
if (attributes != null)
{
ASN1 asn3 = new ASN1(49);
IDictionaryEnumerator enumerator = attributes.GetEnumerator();
while (enumerator.MoveNext())
{
string text = (string)enumerator.Key;
string text2 = text;
if (text2 != null)
{
if (PKCS12.<>f__switch$mapD == null)
{
PKCS12.<>f__switch$mapD = new Dictionary<string, int>(2)
{
{ "1.2.840.113549.1.9.20", 0 },
{ "1.2.840.113549.1.9.21", 1 }
};
}
int num;
if (PKCS12.<>f__switch$mapD.TryGetValue(text2, out num))
{
if (num != 0)
{
if (num == 1)
{
ArrayList arrayList = (ArrayList)enumerator.Value;
if (arrayList.Count > 0)
{
ASN1 asn4 = new ASN1(48);
asn4.Add(ASN1Convert.FromOid("1.2.840.113549.1.9.21"));
ASN1 asn5 = new ASN1(49);
foreach (object obj in arrayList)
{
byte[] array = (byte[])obj;
asn5.Add(new ASN1(4)
{
Value = array
});
}
asn4.Add(asn5);
asn3.Add(asn4);
}
}
}
else
{
ArrayList arrayList2 = (ArrayList)enumerator.Value;
if (arrayList2.Count > 0)
{
ASN1 asn6 = new ASN1(48);
asn6.Add(ASN1Convert.FromOid("1.2.840.113549.1.9.20"));
ASN1 asn7 = new ASN1(49);
foreach (object obj2 in arrayList2)
{
byte[] array2 = (byte[])obj2;
asn7.Add(new ASN1(30)
{
Value = array2
});
}
asn6.Add(asn7);
asn3.Add(asn6);
}
}
}
}
}
if (asn3.Count > 0)
{
asn.Add(asn3);
}
}
return asn;
}
// Token: 0x060009CD RID: 2509 RVA: 0x00029784 File Offset: 0x00027984
private ASN1 SecretBagSafeBag(byte[] secret, IDictionary attributes)
{
ASN1 asn = new ASN1(48);
asn.Add(ASN1Convert.FromOid("1.2.840.113549.1.12.10.1.5"));
ASN1 asn2 = new ASN1(128, secret);
asn.Add(asn2);
if (attributes != null)
{
ASN1 asn3 = new ASN1(49);
IDictionaryEnumerator enumerator = attributes.GetEnumerator();
while (enumerator.MoveNext())
{
string text = (string)enumerator.Key;
string text2 = text;
if (text2 != null)
{
if (PKCS12.<>f__switch$mapE == null)
{
PKCS12.<>f__switch$mapE = new Dictionary<string, int>(2)
{
{ "1.2.840.113549.1.9.20", 0 },
{ "1.2.840.113549.1.9.21", 1 }
};
}
int num;
if (PKCS12.<>f__switch$mapE.TryGetValue(text2, out num))
{
if (num != 0)
{
if (num == 1)
{
ArrayList arrayList = (ArrayList)enumerator.Value;
if (arrayList.Count > 0)
{
ASN1 asn4 = new ASN1(48);
asn4.Add(ASN1Convert.FromOid("1.2.840.113549.1.9.21"));
ASN1 asn5 = new ASN1(49);
foreach (object obj in arrayList)
{
byte[] array = (byte[])obj;
asn5.Add(new ASN1(4)
{
Value = array
});
}
asn4.Add(asn5);
asn3.Add(asn4);
}
}
}
else
{
ArrayList arrayList2 = (ArrayList)enumerator.Value;
if (arrayList2.Count > 0)
{
ASN1 asn6 = new ASN1(48);
asn6.Add(ASN1Convert.FromOid("1.2.840.113549.1.9.20"));
ASN1 asn7 = new ASN1(49);
foreach (object obj2 in arrayList2)
{
byte[] array2 = (byte[])obj2;
asn7.Add(new ASN1(30)
{
Value = array2
});
}
asn6.Add(asn7);
asn3.Add(asn6);
}
}
}
}
}
if (asn3.Count > 0)
{
asn.Add(asn3);
}
}
return asn;
}
// Token: 0x060009CE RID: 2510 RVA: 0x00029A0C File Offset: 0x00027C0C
private ASN1 CertificateSafeBag(X509Certificate x509, IDictionary attributes)
{
ASN1 asn = new ASN1(4, x509.RawData);
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo();
contentInfo.ContentType = "1.2.840.113549.1.9.22.1";
contentInfo.Content.Add(asn);
ASN1 asn2 = new ASN1(160);
asn2.Add(contentInfo.ASN1);
ASN1 asn3 = new ASN1(48);
asn3.Add(ASN1Convert.FromOid("1.2.840.113549.1.12.10.1.3"));
asn3.Add(asn2);
if (attributes != null)
{
ASN1 asn4 = new ASN1(49);
IDictionaryEnumerator enumerator = attributes.GetEnumerator();
while (enumerator.MoveNext())
{
string text = (string)enumerator.Key;
string text2 = text;
if (text2 != null)
{
if (PKCS12.<>f__switch$mapF == null)
{
PKCS12.<>f__switch$mapF = new Dictionary<string, int>(2)
{
{ "1.2.840.113549.1.9.20", 0 },
{ "1.2.840.113549.1.9.21", 1 }
};
}
int num;
if (PKCS12.<>f__switch$mapF.TryGetValue(text2, out num))
{
if (num != 0)
{
if (num == 1)
{
ArrayList arrayList = (ArrayList)enumerator.Value;
if (arrayList.Count > 0)
{
ASN1 asn5 = new ASN1(48);
asn5.Add(ASN1Convert.FromOid("1.2.840.113549.1.9.21"));
ASN1 asn6 = new ASN1(49);
foreach (object obj in arrayList)
{
byte[] array = (byte[])obj;
asn6.Add(new ASN1(4)
{
Value = array
});
}
asn5.Add(asn6);
asn4.Add(asn5);
}
}
}
else
{
ArrayList arrayList2 = (ArrayList)enumerator.Value;
if (arrayList2.Count > 0)
{
ASN1 asn7 = new ASN1(48);
asn7.Add(ASN1Convert.FromOid("1.2.840.113549.1.9.20"));
ASN1 asn8 = new ASN1(49);
foreach (object obj2 in arrayList2)
{
byte[] array2 = (byte[])obj2;
asn8.Add(new ASN1(30)
{
Value = array2
});
}
asn7.Add(asn8);
asn4.Add(asn7);
}
}
}
}
}
if (asn4.Count > 0)
{
asn3.Add(asn4);
}
}
return asn3;
}
// Token: 0x060009CF RID: 2511 RVA: 0x00029CD8 File Offset: 0x00027ED8
private byte[] MAC(byte[] password, byte[] salt, int iterations, byte[] data)
{
PKCS12.DeriveBytes deriveBytes = new PKCS12.DeriveBytes();
deriveBytes.HashName = "SHA1";
deriveBytes.Password = password;
deriveBytes.Salt = salt;
deriveBytes.IterationCount = iterations;
HMACSHA1 hmacsha = (HMACSHA1)HMAC.Create();
hmacsha.Key = deriveBytes.DeriveMAC(20);
return hmacsha.ComputeHash(data, 0, data.Length);
}
// Token: 0x060009D0 RID: 2512 RVA: 0x00029D34 File Offset: 0x00027F34
public byte[] GetBytes()
{
ASN1 asn = new ASN1(48);
ArrayList arrayList = new ArrayList();
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.3"))
{
ASN1 asn2 = safeBag.ASN1;
ASN1 asn3 = asn2[1];
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo(asn3.Value);
arrayList.Add(new X509Certificate(contentInfo.Content[0].Value));
}
}
ArrayList arrayList2 = new ArrayList();
ArrayList arrayList3 = new ArrayList();
foreach (X509Certificate x509Certificate in this.Certificates)
{
bool flag = false;
foreach (object obj2 in arrayList)
{
X509Certificate x509Certificate2 = (X509Certificate)obj2;
if (this.Compare(x509Certificate.RawData, x509Certificate2.RawData))
{
flag = true;
}
}
if (!flag)
{
arrayList2.Add(x509Certificate);
}
}
foreach (object obj3 in arrayList)
{
X509Certificate x509Certificate3 = (X509Certificate)obj3;
bool flag2 = false;
foreach (X509Certificate x509Certificate4 in this.Certificates)
{
if (this.Compare(x509Certificate3.RawData, x509Certificate4.RawData))
{
flag2 = true;
}
}
if (!flag2)
{
arrayList3.Add(x509Certificate3);
}
}
foreach (object obj4 in arrayList3)
{
X509Certificate x509Certificate5 = (X509Certificate)obj4;
this.RemoveCertificate(x509Certificate5);
}
foreach (object obj5 in arrayList2)
{
X509Certificate x509Certificate6 = (X509Certificate)obj5;
this.AddCertificate(x509Certificate6);
}
if (this._safeBags.Count > 0)
{
ASN1 asn4 = new ASN1(48);
foreach (object obj6 in this._safeBags)
{
SafeBag safeBag2 = (SafeBag)obj6;
if (safeBag2.BagOID.Equals("1.2.840.113549.1.12.10.1.3"))
{
asn4.Add(safeBag2.ASN1);
}
}
if (asn4.Count > 0)
{
PKCS7.ContentInfo contentInfo2 = this.EncryptedContentInfo(asn4, "1.2.840.113549.1.12.1.3");
asn.Add(contentInfo2.ASN1);
}
}
if (this._safeBags.Count > 0)
{
ASN1 asn5 = new ASN1(48);
foreach (object obj7 in this._safeBags)
{
SafeBag safeBag3 = (SafeBag)obj7;
if (safeBag3.BagOID.Equals("1.2.840.113549.1.12.10.1.1") || safeBag3.BagOID.Equals("1.2.840.113549.1.12.10.1.2"))
{
asn5.Add(safeBag3.ASN1);
}
}
if (asn5.Count > 0)
{
ASN1 asn6 = new ASN1(160);
asn6.Add(new ASN1(4, asn5.GetBytes()));
asn.Add(new PKCS7.ContentInfo("1.2.840.113549.1.7.1")
{
Content = asn6
}.ASN1);
}
}
if (this._safeBags.Count > 0)
{
ASN1 asn7 = new ASN1(48);
foreach (object obj8 in this._safeBags)
{
SafeBag safeBag4 = (SafeBag)obj8;
if (safeBag4.BagOID.Equals("1.2.840.113549.1.12.10.1.5"))
{
asn7.Add(safeBag4.ASN1);
}
}
if (asn7.Count > 0)
{
PKCS7.ContentInfo contentInfo3 = this.EncryptedContentInfo(asn7, "1.2.840.113549.1.12.1.3");
asn.Add(contentInfo3.ASN1);
}
}
ASN1 asn8 = new ASN1(4, asn.GetBytes());
ASN1 asn9 = new ASN1(160);
asn9.Add(asn8);
PKCS7.ContentInfo contentInfo4 = new PKCS7.ContentInfo("1.2.840.113549.1.7.1");
contentInfo4.Content = asn9;
ASN1 asn10 = new ASN1(48);
if (this._password != null)
{
byte[] array = new byte[20];
this.RNG.GetBytes(array);
byte[] array2 = this.MAC(this._password, array, this._iterations, contentInfo4.Content[0].Value);
ASN1 asn11 = new ASN1(48);
asn11.Add(ASN1Convert.FromOid("1.3.14.3.2.26"));
asn11.Add(new ASN1(5));
ASN1 asn12 = new ASN1(48);
asn12.Add(asn11);
asn12.Add(new ASN1(4, array2));
asn10.Add(asn12);
asn10.Add(new ASN1(4, array));
asn10.Add(ASN1Convert.FromInt32(this._iterations));
}
ASN1 asn13 = new ASN1(2, new byte[] { 3 });
ASN1 asn14 = new ASN1(48);
asn14.Add(asn13);
asn14.Add(contentInfo4.ASN1);
if (asn10.Count > 0)
{
asn14.Add(asn10);
}
return asn14.GetBytes();
}
// Token: 0x060009D1 RID: 2513 RVA: 0x0002A488 File Offset: 0x00028688
private PKCS7.ContentInfo EncryptedContentInfo(ASN1 safeBags, string algorithmOid)
{
byte[] array = new byte[8];
this.RNG.GetBytes(array);
ASN1 asn = new ASN1(48);
asn.Add(new ASN1(4, array));
asn.Add(ASN1Convert.FromInt32(this._iterations));
ASN1 asn2 = new ASN1(48);
asn2.Add(ASN1Convert.FromOid(algorithmOid));
asn2.Add(asn);
byte[] array2 = this.Encrypt(algorithmOid, array, this._iterations, safeBags.GetBytes());
ASN1 asn3 = new ASN1(128, array2);
ASN1 asn4 = new ASN1(48);
asn4.Add(ASN1Convert.FromOid("1.2.840.113549.1.7.1"));
asn4.Add(asn2);
asn4.Add(asn3);
ASN1 asn5 = new ASN1(2, new byte[1]);
ASN1 asn6 = new ASN1(48);
asn6.Add(asn5);
asn6.Add(asn4);
ASN1 asn7 = new ASN1(160);
asn7.Add(asn6);
return new PKCS7.ContentInfo("1.2.840.113549.1.7.6")
{
Content = asn7
};
}
// Token: 0x060009D2 RID: 2514 RVA: 0x0002A598 File Offset: 0x00028798
public void AddCertificate(X509Certificate cert)
{
this.AddCertificate(cert, null);
}
// Token: 0x060009D3 RID: 2515 RVA: 0x0002A5A4 File Offset: 0x000287A4
public void AddCertificate(X509Certificate cert, IDictionary attributes)
{
bool flag = false;
int num = 0;
while (!flag && num < this._safeBags.Count)
{
SafeBag safeBag = (SafeBag)this._safeBags[num];
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.3"))
{
ASN1 asn = safeBag.ASN1;
ASN1 asn2 = asn[1];
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo(asn2.Value);
X509Certificate x509Certificate = new X509Certificate(contentInfo.Content[0].Value);
if (this.Compare(cert.RawData, x509Certificate.RawData))
{
flag = true;
}
}
num++;
}
if (!flag)
{
this._safeBags.Add(new SafeBag("1.2.840.113549.1.12.10.1.3", this.CertificateSafeBag(cert, attributes)));
this._certsChanged = true;
}
}
// Token: 0x060009D4 RID: 2516 RVA: 0x0002A678 File Offset: 0x00028878
public void RemoveCertificate(X509Certificate cert)
{
this.RemoveCertificate(cert, null);
}
// Token: 0x060009D5 RID: 2517 RVA: 0x0002A684 File Offset: 0x00028884
public void RemoveCertificate(X509Certificate cert, IDictionary attrs)
{
int num = -1;
int num2 = 0;
while (num == -1 && num2 < this._safeBags.Count)
{
SafeBag safeBag = (SafeBag)this._safeBags[num2];
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.3"))
{
ASN1 asn = safeBag.ASN1;
ASN1 asn2 = asn[1];
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo(asn2.Value);
X509Certificate x509Certificate = new X509Certificate(contentInfo.Content[0].Value);
if (this.Compare(cert.RawData, x509Certificate.RawData))
{
if (attrs != null)
{
if (asn.Count == 3)
{
ASN1 asn3 = asn[2];
int num3 = 0;
for (int i = 0; i < asn3.Count; i++)
{
ASN1 asn4 = asn3[i];
ASN1 asn5 = asn4[0];
string text = ASN1Convert.ToOid(asn5);
ArrayList arrayList = (ArrayList)attrs[text];
if (arrayList != null)
{
ASN1 asn6 = asn4[1];
if (arrayList.Count == asn6.Count)
{
int num4 = 0;
for (int j = 0; j < asn6.Count; j++)
{
ASN1 asn7 = asn6[j];
byte[] array = (byte[])arrayList[j];
if (this.Compare(array, asn7.Value))
{
num4++;
}
}
if (num4 == asn6.Count)
{
num3++;
}
}
}
}
if (num3 == asn3.Count)
{
num = num2;
}
}
}
else
{
num = num2;
}
}
}
num2++;
}
if (num != -1)
{
this._safeBags.RemoveAt(num);
this._certsChanged = true;
}
}
// Token: 0x060009D6 RID: 2518 RVA: 0x0002A850 File Offset: 0x00028A50
private bool CompareAsymmetricAlgorithm(AsymmetricAlgorithm a1, AsymmetricAlgorithm a2)
{
return a1.KeySize == a2.KeySize && a1.ToXmlString(false) == a2.ToXmlString(false);
}
// Token: 0x060009D7 RID: 2519 RVA: 0x0002A884 File Offset: 0x00028A84
public void AddPkcs8ShroudedKeyBag(AsymmetricAlgorithm aa)
{
this.AddPkcs8ShroudedKeyBag(aa, null);
}
// Token: 0x060009D8 RID: 2520 RVA: 0x0002A890 File Offset: 0x00028A90
public void AddPkcs8ShroudedKeyBag(AsymmetricAlgorithm aa, IDictionary attributes)
{
bool flag = false;
int num = 0;
while (!flag && num < this._safeBags.Count)
{
SafeBag safeBag = (SafeBag)this._safeBags[num];
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.2"))
{
ASN1 asn = safeBag.ASN1[1];
PKCS8.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = new PKCS8.EncryptedPrivateKeyInfo(asn.Value);
byte[] array = this.Decrypt(encryptedPrivateKeyInfo.Algorithm, encryptedPrivateKeyInfo.Salt, encryptedPrivateKeyInfo.IterationCount, encryptedPrivateKeyInfo.EncryptedData);
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo(array);
byte[] privateKey = privateKeyInfo.PrivateKey;
byte b = privateKey[0];
AsymmetricAlgorithm asymmetricAlgorithm;
if (b != 2)
{
if (b != 48)
{
Array.Clear(array, 0, array.Length);
Array.Clear(privateKey, 0, privateKey.Length);
throw new CryptographicException("Unknown private key format");
}
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeRSA(privateKey);
}
else
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeDSA(privateKey, default(DSAParameters));
}
Array.Clear(array, 0, array.Length);
Array.Clear(privateKey, 0, privateKey.Length);
if (this.CompareAsymmetricAlgorithm(aa, asymmetricAlgorithm))
{
flag = true;
}
}
num++;
}
if (!flag)
{
this._safeBags.Add(new SafeBag("1.2.840.113549.1.12.10.1.2", this.Pkcs8ShroudedKeyBagSafeBag(aa, attributes)));
this._keyBagsChanged = true;
}
}
// Token: 0x060009D9 RID: 2521 RVA: 0x0002A9F4 File Offset: 0x00028BF4
public void RemovePkcs8ShroudedKeyBag(AsymmetricAlgorithm aa)
{
int num = -1;
int num2 = 0;
while (num == -1 && num2 < this._safeBags.Count)
{
SafeBag safeBag = (SafeBag)this._safeBags[num2];
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.2"))
{
ASN1 asn = safeBag.ASN1[1];
PKCS8.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = new PKCS8.EncryptedPrivateKeyInfo(asn.Value);
byte[] array = this.Decrypt(encryptedPrivateKeyInfo.Algorithm, encryptedPrivateKeyInfo.Salt, encryptedPrivateKeyInfo.IterationCount, encryptedPrivateKeyInfo.EncryptedData);
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo(array);
byte[] privateKey = privateKeyInfo.PrivateKey;
byte b = privateKey[0];
AsymmetricAlgorithm asymmetricAlgorithm;
if (b != 2)
{
if (b != 48)
{
Array.Clear(array, 0, array.Length);
Array.Clear(privateKey, 0, privateKey.Length);
throw new CryptographicException("Unknown private key format");
}
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeRSA(privateKey);
}
else
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeDSA(privateKey, default(DSAParameters));
}
Array.Clear(array, 0, array.Length);
Array.Clear(privateKey, 0, privateKey.Length);
if (this.CompareAsymmetricAlgorithm(aa, asymmetricAlgorithm))
{
num = num2;
}
}
num2++;
}
if (num != -1)
{
this._safeBags.RemoveAt(num);
this._keyBagsChanged = true;
}
}
// Token: 0x060009DA RID: 2522 RVA: 0x0002AB48 File Offset: 0x00028D48
public void AddKeyBag(AsymmetricAlgorithm aa)
{
this.AddKeyBag(aa, null);
}
// Token: 0x060009DB RID: 2523 RVA: 0x0002AB54 File Offset: 0x00028D54
public void AddKeyBag(AsymmetricAlgorithm aa, IDictionary attributes)
{
bool flag = false;
int num = 0;
while (!flag && num < this._safeBags.Count)
{
SafeBag safeBag = (SafeBag)this._safeBags[num];
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.1"))
{
ASN1 asn = safeBag.ASN1[1];
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo(asn.Value);
byte[] privateKey = privateKeyInfo.PrivateKey;
byte b = privateKey[0];
AsymmetricAlgorithm asymmetricAlgorithm;
if (b != 2)
{
if (b != 48)
{
Array.Clear(privateKey, 0, privateKey.Length);
throw new CryptographicException("Unknown private key format");
}
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeRSA(privateKey);
}
else
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeDSA(privateKey, default(DSAParameters));
}
Array.Clear(privateKey, 0, privateKey.Length);
if (this.CompareAsymmetricAlgorithm(aa, asymmetricAlgorithm))
{
flag = true;
}
}
num++;
}
if (!flag)
{
this._safeBags.Add(new SafeBag("1.2.840.113549.1.12.10.1.1", this.KeyBagSafeBag(aa, attributes)));
this._keyBagsChanged = true;
}
}
// Token: 0x060009DC RID: 2524 RVA: 0x0002AC74 File Offset: 0x00028E74
public void RemoveKeyBag(AsymmetricAlgorithm aa)
{
int num = -1;
int num2 = 0;
while (num == -1 && num2 < this._safeBags.Count)
{
SafeBag safeBag = (SafeBag)this._safeBags[num2];
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.1"))
{
ASN1 asn = safeBag.ASN1[1];
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo(asn.Value);
byte[] privateKey = privateKeyInfo.PrivateKey;
byte b = privateKey[0];
AsymmetricAlgorithm asymmetricAlgorithm;
if (b != 2)
{
if (b != 48)
{
Array.Clear(privateKey, 0, privateKey.Length);
throw new CryptographicException("Unknown private key format");
}
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeRSA(privateKey);
}
else
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeDSA(privateKey, default(DSAParameters));
}
Array.Clear(privateKey, 0, privateKey.Length);
if (this.CompareAsymmetricAlgorithm(aa, asymmetricAlgorithm))
{
num = num2;
}
}
num2++;
}
if (num != -1)
{
this._safeBags.RemoveAt(num);
this._keyBagsChanged = true;
}
}
// Token: 0x060009DD RID: 2525 RVA: 0x0002AD84 File Offset: 0x00028F84
public void AddSecretBag(byte[] secret)
{
this.AddSecretBag(secret, null);
}
// Token: 0x060009DE RID: 2526 RVA: 0x0002AD90 File Offset: 0x00028F90
public void AddSecretBag(byte[] secret, IDictionary attributes)
{
bool flag = false;
int num = 0;
while (!flag && num < this._safeBags.Count)
{
SafeBag safeBag = (SafeBag)this._safeBags[num];
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.5"))
{
ASN1 asn = safeBag.ASN1[1];
byte[] value = asn.Value;
if (this.Compare(secret, value))
{
flag = true;
}
}
num++;
}
if (!flag)
{
this._safeBags.Add(new SafeBag("1.2.840.113549.1.12.10.1.5", this.SecretBagSafeBag(secret, attributes)));
this._secretBagsChanged = true;
}
}
// Token: 0x060009DF RID: 2527 RVA: 0x0002AE38 File Offset: 0x00029038
public void RemoveSecretBag(byte[] secret)
{
int num = -1;
int num2 = 0;
while (num == -1 && num2 < this._safeBags.Count)
{
SafeBag safeBag = (SafeBag)this._safeBags[num2];
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.5"))
{
ASN1 asn = safeBag.ASN1[1];
byte[] value = asn.Value;
if (this.Compare(secret, value))
{
num = num2;
}
}
num2++;
}
if (num != -1)
{
this._safeBags.RemoveAt(num);
this._secretBagsChanged = true;
}
}
// Token: 0x060009E0 RID: 2528 RVA: 0x0002AED0 File Offset: 0x000290D0
public AsymmetricAlgorithm GetAsymmetricAlgorithm(IDictionary attrs)
{
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.1") || safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.2"))
{
ASN1 asn = safeBag.ASN1;
if (asn.Count == 3)
{
ASN1 asn2 = asn[2];
int num = 0;
for (int i = 0; i < asn2.Count; i++)
{
ASN1 asn3 = asn2[i];
ASN1 asn4 = asn3[0];
string text = ASN1Convert.ToOid(asn4);
ArrayList arrayList = (ArrayList)attrs[text];
if (arrayList != null)
{
ASN1 asn5 = asn3[1];
if (arrayList.Count == asn5.Count)
{
int num2 = 0;
for (int j = 0; j < asn5.Count; j++)
{
ASN1 asn6 = asn5[j];
byte[] array = (byte[])arrayList[j];
if (this.Compare(array, asn6.Value))
{
num2++;
}
}
if (num2 == asn5.Count)
{
num++;
}
}
}
}
if (num == asn2.Count)
{
ASN1 asn7 = asn[1];
AsymmetricAlgorithm asymmetricAlgorithm = null;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.1"))
{
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo(asn7.Value);
byte[] privateKey = privateKeyInfo.PrivateKey;
byte b = privateKey[0];
if (b != 2)
{
if (b == 48)
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeRSA(privateKey);
}
}
else
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeDSA(privateKey, default(DSAParameters));
}
Array.Clear(privateKey, 0, privateKey.Length);
}
else if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.2"))
{
PKCS8.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = new PKCS8.EncryptedPrivateKeyInfo(asn7.Value);
byte[] array2 = this.Decrypt(encryptedPrivateKeyInfo.Algorithm, encryptedPrivateKeyInfo.Salt, encryptedPrivateKeyInfo.IterationCount, encryptedPrivateKeyInfo.EncryptedData);
PKCS8.PrivateKeyInfo privateKeyInfo2 = new PKCS8.PrivateKeyInfo(array2);
byte[] privateKey2 = privateKeyInfo2.PrivateKey;
byte b = privateKey2[0];
if (b != 2)
{
if (b == 48)
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeRSA(privateKey2);
}
}
else
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeDSA(privateKey2, default(DSAParameters));
}
Array.Clear(privateKey2, 0, privateKey2.Length);
Array.Clear(array2, 0, array2.Length);
}
return asymmetricAlgorithm;
}
}
}
}
return null;
}
// Token: 0x060009E1 RID: 2529 RVA: 0x0002B1B8 File Offset: 0x000293B8
public byte[] GetSecret(IDictionary attrs)
{
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.5"))
{
ASN1 asn = safeBag.ASN1;
if (asn.Count == 3)
{
ASN1 asn2 = asn[2];
int num = 0;
for (int i = 0; i < asn2.Count; i++)
{
ASN1 asn3 = asn2[i];
ASN1 asn4 = asn3[0];
string text = ASN1Convert.ToOid(asn4);
ArrayList arrayList = (ArrayList)attrs[text];
if (arrayList != null)
{
ASN1 asn5 = asn3[1];
if (arrayList.Count == asn5.Count)
{
int num2 = 0;
for (int j = 0; j < asn5.Count; j++)
{
ASN1 asn6 = asn5[j];
byte[] array = (byte[])arrayList[j];
if (this.Compare(array, asn6.Value))
{
num2++;
}
}
if (num2 == asn5.Count)
{
num++;
}
}
}
}
if (num == asn2.Count)
{
ASN1 asn7 = asn[1];
return asn7.Value;
}
}
}
}
return null;
}
// Token: 0x060009E2 RID: 2530 RVA: 0x0002B354 File Offset: 0x00029554
public X509Certificate GetCertificate(IDictionary attrs)
{
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.3"))
{
ASN1 asn = safeBag.ASN1;
if (asn.Count == 3)
{
ASN1 asn2 = asn[2];
int num = 0;
for (int i = 0; i < asn2.Count; i++)
{
ASN1 asn3 = asn2[i];
ASN1 asn4 = asn3[0];
string text = ASN1Convert.ToOid(asn4);
ArrayList arrayList = (ArrayList)attrs[text];
if (arrayList != null)
{
ASN1 asn5 = asn3[1];
if (arrayList.Count == asn5.Count)
{
int num2 = 0;
for (int j = 0; j < asn5.Count; j++)
{
ASN1 asn6 = asn5[j];
byte[] array = (byte[])arrayList[j];
if (this.Compare(array, asn6.Value))
{
num2++;
}
}
if (num2 == asn5.Count)
{
num++;
}
}
}
}
if (num == asn2.Count)
{
ASN1 asn7 = asn[1];
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo(asn7.Value);
return new X509Certificate(contentInfo.Content[0].Value);
}
}
}
}
return null;
}
// Token: 0x060009E3 RID: 2531 RVA: 0x0002B50C File Offset: 0x0002970C
public IDictionary GetAttributes(AsymmetricAlgorithm aa)
{
IDictionary dictionary = new Hashtable();
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.1") || safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.2"))
{
ASN1 asn = safeBag.ASN1;
ASN1 asn2 = asn[1];
AsymmetricAlgorithm asymmetricAlgorithm = null;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.1"))
{
PKCS8.PrivateKeyInfo privateKeyInfo = new PKCS8.PrivateKeyInfo(asn2.Value);
byte[] privateKey = privateKeyInfo.PrivateKey;
byte b = privateKey[0];
if (b != 2)
{
if (b == 48)
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeRSA(privateKey);
}
}
else
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeDSA(privateKey, default(DSAParameters));
}
Array.Clear(privateKey, 0, privateKey.Length);
}
else if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.2"))
{
PKCS8.EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = new PKCS8.EncryptedPrivateKeyInfo(asn2.Value);
byte[] array = this.Decrypt(encryptedPrivateKeyInfo.Algorithm, encryptedPrivateKeyInfo.Salt, encryptedPrivateKeyInfo.IterationCount, encryptedPrivateKeyInfo.EncryptedData);
PKCS8.PrivateKeyInfo privateKeyInfo2 = new PKCS8.PrivateKeyInfo(array);
byte[] privateKey2 = privateKeyInfo2.PrivateKey;
byte b = privateKey2[0];
if (b != 2)
{
if (b == 48)
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeRSA(privateKey2);
}
}
else
{
asymmetricAlgorithm = PKCS8.PrivateKeyInfo.DecodeDSA(privateKey2, default(DSAParameters));
}
Array.Clear(privateKey2, 0, privateKey2.Length);
Array.Clear(array, 0, array.Length);
}
if (asymmetricAlgorithm != null && this.CompareAsymmetricAlgorithm(asymmetricAlgorithm, aa) && asn.Count == 3)
{
ASN1 asn3 = asn[2];
for (int i = 0; i < asn3.Count; i++)
{
ASN1 asn4 = asn3[i];
ASN1 asn5 = asn4[0];
string text = ASN1Convert.ToOid(asn5);
ArrayList arrayList = new ArrayList();
ASN1 asn6 = asn4[1];
for (int j = 0; j < asn6.Count; j++)
{
ASN1 asn7 = asn6[j];
arrayList.Add(asn7.Value);
}
dictionary.Add(text, arrayList);
}
}
}
}
return dictionary;
}
// Token: 0x060009E4 RID: 2532 RVA: 0x0002B7AC File Offset: 0x000299AC
public IDictionary GetAttributes(X509Certificate cert)
{
IDictionary dictionary = new Hashtable();
foreach (object obj in this._safeBags)
{
SafeBag safeBag = (SafeBag)obj;
if (safeBag.BagOID.Equals("1.2.840.113549.1.12.10.1.3"))
{
ASN1 asn = safeBag.ASN1;
ASN1 asn2 = asn[1];
PKCS7.ContentInfo contentInfo = new PKCS7.ContentInfo(asn2.Value);
X509Certificate x509Certificate = new X509Certificate(contentInfo.Content[0].Value);
if (this.Compare(cert.RawData, x509Certificate.RawData) && asn.Count == 3)
{
ASN1 asn3 = asn[2];
for (int i = 0; i < asn3.Count; i++)
{
ASN1 asn4 = asn3[i];
ASN1 asn5 = asn4[0];
string text = ASN1Convert.ToOid(asn5);
ArrayList arrayList = new ArrayList();
ASN1 asn6 = asn4[1];
for (int j = 0; j < asn6.Count; j++)
{
ASN1 asn7 = asn6[j];
arrayList.Add(asn7.Value);
}
dictionary.Add(text, arrayList);
}
}
}
}
return dictionary;
}
// Token: 0x060009E5 RID: 2533 RVA: 0x0002B924 File Offset: 0x00029B24
public void SaveToFile(string filename)
{
if (filename == null)
{
throw new ArgumentNullException("filename");
}
using (FileStream fileStream = File.Create(filename))
{
byte[] bytes = this.GetBytes();
fileStream.Write(bytes, 0, bytes.Length);
}
}
// Token: 0x060009E6 RID: 2534 RVA: 0x0002B98C File Offset: 0x00029B8C
public object Clone()
{
PKCS12 pkcs;
if (this._password != null)
{
pkcs = new PKCS12(this.GetBytes(), Encoding.BigEndianUnicode.GetString(this._password));
}
else
{
pkcs = new PKCS12(this.GetBytes());
}
pkcs.IterationCount = this.IterationCount;
return pkcs;
}
// Token: 0x17000125 RID: 293
// (get) Token: 0x060009E7 RID: 2535 RVA: 0x0002B9E0 File Offset: 0x00029BE0
// (set) Token: 0x060009E8 RID: 2536 RVA: 0x0002B9E8 File Offset: 0x00029BE8
public static int MaximumPasswordLength
{
get
{
return PKCS12.password_max_length;
}
set
{
if (value < 32)
{
string text = Locale.GetText("Maximum password length cannot be less than {0}.", new object[] { 32 });
throw new ArgumentOutOfRangeException(text);
}
PKCS12.password_max_length = value;
}
}
// Token: 0x060009E9 RID: 2537 RVA: 0x0002BA28 File Offset: 0x00029C28
private static byte[] LoadFile(string filename)
{
byte[] array = null;
using (FileStream fileStream = File.OpenRead(filename))
{
array = new byte[fileStream.Length];
fileStream.Read(array, 0, array.Length);
fileStream.Close();
}
return array;
}
// Token: 0x060009EA RID: 2538 RVA: 0x0002BA8C File Offset: 0x00029C8C
public static PKCS12 LoadFromFile(string filename)
{
if (filename == null)
{
throw new ArgumentNullException("filename");
}
return new PKCS12(PKCS12.LoadFile(filename));
}
// Token: 0x060009EB RID: 2539 RVA: 0x0002BAAC File Offset: 0x00029CAC
public static PKCS12 LoadFromFile(string filename, string password)
{
if (filename == null)
{
throw new ArgumentNullException("filename");
}
return new PKCS12(PKCS12.LoadFile(filename), password);
}
// Token: 0x04000244 RID: 580
public const string pbeWithSHAAnd128BitRC4 = "1.2.840.113549.1.12.1.1";
// Token: 0x04000245 RID: 581
public const string pbeWithSHAAnd40BitRC4 = "1.2.840.113549.1.12.1.2";
// Token: 0x04000246 RID: 582
public const string pbeWithSHAAnd3KeyTripleDESCBC = "1.2.840.113549.1.12.1.3";
// Token: 0x04000247 RID: 583
public const string pbeWithSHAAnd2KeyTripleDESCBC = "1.2.840.113549.1.12.1.4";
// Token: 0x04000248 RID: 584
public const string pbeWithSHAAnd128BitRC2CBC = "1.2.840.113549.1.12.1.5";
// Token: 0x04000249 RID: 585
public const string pbeWithSHAAnd40BitRC2CBC = "1.2.840.113549.1.12.1.6";
// Token: 0x0400024A RID: 586
public const string keyBag = "1.2.840.113549.1.12.10.1.1";
// Token: 0x0400024B RID: 587
public const string pkcs8ShroudedKeyBag = "1.2.840.113549.1.12.10.1.2";
// Token: 0x0400024C RID: 588
public const string certBag = "1.2.840.113549.1.12.10.1.3";
// Token: 0x0400024D RID: 589
public const string crlBag = "1.2.840.113549.1.12.10.1.4";
// Token: 0x0400024E RID: 590
public const string secretBag = "1.2.840.113549.1.12.10.1.5";
// Token: 0x0400024F RID: 591
public const string safeContentsBag = "1.2.840.113549.1.12.10.1.6";
// Token: 0x04000250 RID: 592
public const string x509Certificate = "1.2.840.113549.1.9.22.1";
// Token: 0x04000251 RID: 593
public const string sdsiCertificate = "1.2.840.113549.1.9.22.2";
// Token: 0x04000252 RID: 594
public const string x509Crl = "1.2.840.113549.1.9.23.1";
// Token: 0x04000253 RID: 595
public const int CryptoApiPasswordLimit = 32;
// Token: 0x04000254 RID: 596
private static int recommendedIterationCount = 2000;
// Token: 0x04000255 RID: 597
private byte[] _password;
// Token: 0x04000256 RID: 598
private ArrayList _keyBags;
// Token: 0x04000257 RID: 599
private ArrayList _secretBags;
// Token: 0x04000258 RID: 600
private X509CertificateCollection _certs;
// Token: 0x04000259 RID: 601
private bool _keyBagsChanged;
// Token: 0x0400025A RID: 602
private bool _secretBagsChanged;
// Token: 0x0400025B RID: 603
private bool _certsChanged;
// Token: 0x0400025C RID: 604
private int _iterations;
// Token: 0x0400025D RID: 605
private ArrayList _safeBags;
// Token: 0x0400025E RID: 606
private RandomNumberGenerator _rng;
// Token: 0x0400025F RID: 607
private static int password_max_length = int.MaxValue;
// Token: 0x020000B7 RID: 183
public class DeriveBytes
{
// Token: 0x17000126 RID: 294
// (get) Token: 0x060009EE RID: 2542 RVA: 0x0002BB28 File Offset: 0x00029D28
// (set) Token: 0x060009EF RID: 2543 RVA: 0x0002BB30 File Offset: 0x00029D30
public string HashName
{
get
{
return this._hashName;
}
set
{
this._hashName = value;
}
}
// Token: 0x17000127 RID: 295
// (get) Token: 0x060009F0 RID: 2544 RVA: 0x0002BB3C File Offset: 0x00029D3C
// (set) Token: 0x060009F1 RID: 2545 RVA: 0x0002BB44 File Offset: 0x00029D44
public int IterationCount
{
get
{
return this._iterations;
}
set
{
this._iterations = value;
}
}
// Token: 0x17000128 RID: 296
// (get) Token: 0x060009F2 RID: 2546 RVA: 0x0002BB50 File Offset: 0x00029D50
// (set) Token: 0x060009F3 RID: 2547 RVA: 0x0002BB64 File Offset: 0x00029D64
public byte[] Password
{
get
{
return (byte[])this._password.Clone();
}
set
{
if (value == null)
{
this._password = new byte[0];
}
else
{
this._password = (byte[])value.Clone();
}
}
}
// Token: 0x17000129 RID: 297
// (get) Token: 0x060009F4 RID: 2548 RVA: 0x0002BB9C File Offset: 0x00029D9C
// (set) Token: 0x060009F5 RID: 2549 RVA: 0x0002BBB0 File Offset: 0x00029DB0
public byte[] Salt
{
get
{
return (byte[])this._salt.Clone();
}
set
{
if (value != null)
{
this._salt = (byte[])value.Clone();
}
else
{
this._salt = null;
}
}
}
// Token: 0x060009F6 RID: 2550 RVA: 0x0002BBD8 File Offset: 0x00029DD8
private void Adjust(byte[] a, int aOff, byte[] b)
{
int num = (int)((b[b.Length - 1] & byte.MaxValue) + (a[aOff + b.Length - 1] & byte.MaxValue) + 1);
a[aOff + b.Length - 1] = (byte)num;
num >>= 8;
for (int i = b.Length - 2; i >= 0; i--)
{
num += (int)((b[i] & byte.MaxValue) + (a[aOff + i] & byte.MaxValue));
a[aOff + i] = (byte)num;
num >>= 8;
}
}
// Token: 0x060009F7 RID: 2551 RVA: 0x0002BC50 File Offset: 0x00029E50
private byte[] Derive(byte[] diversifier, int n)
{
HashAlgorithm hashAlgorithm = HashAlgorithm.Create(this._hashName);
int num = hashAlgorithm.HashSize >> 3;
int num2 = 64;
byte[] array = new byte[n];
byte[] array2;
if (this._salt != null && this._salt.Length != 0)
{
array2 = new byte[num2 * ((this._salt.Length + num2 - 1) / num2)];
for (int num3 = 0; num3 != array2.Length; num3++)
{
array2[num3] = this._salt[num3 % this._salt.Length];
}
}
else
{
array2 = new byte[0];
}
byte[] array3;
if (this._password != null && this._password.Length != 0)
{
array3 = new byte[num2 * ((this._password.Length + num2 - 1) / num2)];
for (int num4 = 0; num4 != array3.Length; num4++)
{
array3[num4] = this._password[num4 % this._password.Length];
}
}
else
{
array3 = new byte[0];
}
byte[] array4 = new byte[array2.Length + array3.Length];
Buffer.BlockCopy(array2, 0, array4, 0, array2.Length);
Buffer.BlockCopy(array3, 0, array4, array2.Length, array3.Length);
byte[] array5 = new byte[num2];
int num5 = (n + num - 1) / num;
for (int i = 1; i <= num5; i++)
{
hashAlgorithm.TransformBlock(diversifier, 0, diversifier.Length, diversifier, 0);
hashAlgorithm.TransformFinalBlock(array4, 0, array4.Length);
byte[] array6 = hashAlgorithm.Hash;
hashAlgorithm.Initialize();
for (int num6 = 1; num6 != this._iterations; num6++)
{
array6 = hashAlgorithm.ComputeHash(array6, 0, array6.Length);
}
for (int num7 = 0; num7 != array5.Length; num7++)
{
array5[num7] = array6[num7 % array6.Length];
}
for (int num8 = 0; num8 != array4.Length / num2; num8++)
{
this.Adjust(array4, num8 * num2, array5);
}
if (i == num5)
{
Buffer.BlockCopy(array6, 0, array, (i - 1) * num, array.Length - (i - 1) * num);
}
else
{
Buffer.BlockCopy(array6, 0, array, (i - 1) * num, array6.Length);
}
}
return array;
}
// Token: 0x060009F8 RID: 2552 RVA: 0x0002BE90 File Offset: 0x0002A090
public byte[] DeriveKey(int size)
{
return this.Derive(PKCS12.DeriveBytes.keyDiversifier, size);
}
// Token: 0x060009F9 RID: 2553 RVA: 0x0002BEA0 File Offset: 0x0002A0A0
public byte[] DeriveIV(int size)
{
return this.Derive(PKCS12.DeriveBytes.ivDiversifier, size);
}
// Token: 0x060009FA RID: 2554 RVA: 0x0002BEB0 File Offset: 0x0002A0B0
public byte[] DeriveMAC(int size)
{
return this.Derive(PKCS12.DeriveBytes.macDiversifier, size);
}
// Token: 0x04000268 RID: 616
private static byte[] keyDiversifier = new byte[]
{
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1
};
// Token: 0x04000269 RID: 617
private static byte[] ivDiversifier = new byte[]
{
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2
};
// Token: 0x0400026A RID: 618
private static byte[] macDiversifier = new byte[]
{
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3
};
// Token: 0x0400026B RID: 619
private string _hashName;
// Token: 0x0400026C RID: 620
private int _iterations;
// Token: 0x0400026D RID: 621
private byte[] _password;
// Token: 0x0400026E RID: 622
private byte[] _salt;
// Token: 0x020000B8 RID: 184
public enum Purpose
{
// Token: 0x04000270 RID: 624
Key,
// Token: 0x04000271 RID: 625
IV,
// Token: 0x04000272 RID: 626
MAC
}
}
}
}