263 lines
7.9 KiB
C#
263 lines
7.9 KiB
C#
using System;
|
|
using System.IO;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
|
|
{
|
|
// Token: 0x02001D29 RID: 7465
|
|
[Token(Token = "0x2001D29")]
|
|
public class CmsAuthenticatedDataParser : CmsContentInfoParser
|
|
{
|
|
// Token: 0x0600BCFD RID: 48381 RVA: 0x002AFDB4 File Offset: 0x002ADFB4
|
|
[Token(Token = "0x600BCFD")]
|
|
[Address(RVA = "0x1660390", Offset = "0x165F190", VA = "0x181660390")]
|
|
public CmsAuthenticatedDataParser(byte[] envelopedData)
|
|
{
|
|
int num;
|
|
MemoryStream memoryStream = new MemoryStream(envelopedData, num != 0);
|
|
num = 0;
|
|
}
|
|
|
|
// Token: 0x0600BCFE RID: 48382 RVA: 0x002AFDCC File Offset: 0x002ADFCC
|
|
[Token(Token = "0x600BCFE")]
|
|
[Address(RVA = "0x1660150", Offset = "0x165EF50", VA = "0x181660150")]
|
|
public CmsAuthenticatedDataParser(Stream envelopedData)
|
|
{
|
|
IAsn1Convertible content;
|
|
for (;;)
|
|
{
|
|
base..ctor(envelopedData);
|
|
ContentInfoParser contentInfo = this.contentInfo;
|
|
this.authAttrNotRead = true;
|
|
if (contentInfo.GetContent(16) == 0)
|
|
{
|
|
}
|
|
AuthenticatedDataParser authenticatedDataParser;
|
|
if (authenticatedDataParser != 0)
|
|
{
|
|
this.authData = authenticatedDataParser;
|
|
Asn1SetParser recipientInfos = authenticatedDataParser.GetRecipientInfos();
|
|
AlgorithmIdentifier macAlgorithm = this.authData.GetMacAlgorithm();
|
|
AuthenticatedDataParser authenticatedDataParser2 = this.authData;
|
|
this.macAlg = macAlgorithm;
|
|
content = authenticatedDataParser2.GetEnapsulatedContentInfo().GetContent(4);
|
|
if (content != 0 && content != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
CmsProcessableInputStream cmsProcessableInputStream;
|
|
cmsProcessableInputStream.input = content;
|
|
AlgorithmIdentifier algorithmIdentifier = this.macAlg;
|
|
CmsEnvelopedHelper.CmsAuthenticatedSecureReadable cmsAuthenticatedSecureReadable;
|
|
cmsAuthenticatedSecureReadable.algorithm = algorithmIdentifier;
|
|
cmsAuthenticatedSecureReadable.readable = cmsProcessableInputStream;
|
|
Asn1Set asn1Set;
|
|
RecipientInformationStore recipientInformationStore = CmsEnvelopedHelper.BuildRecipientInformationStore(asn1Set, cmsAuthenticatedSecureReadable);
|
|
this._recipientInfoStore = recipientInformationStore;
|
|
}
|
|
|
|
// Token: 0x17001D4A RID: 7498
|
|
// (get) Token: 0x0600BCFF RID: 48383 RVA: 0x002AFE7C File Offset: 0x002AE07C
|
|
[Token(Token = "0x17001D4A")]
|
|
public AlgorithmIdentifier MacAlgorithmID
|
|
{
|
|
[Token(Token = "0x600BCFF")]
|
|
[Address(RVA = "0x3FA180", Offset = "0x3F8F80", VA = "0x1803FA180")]
|
|
get
|
|
{
|
|
return this.macAlg;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001D4B RID: 7499
|
|
// (get) Token: 0x0600BD00 RID: 48384 RVA: 0x002AFE90 File Offset: 0x002AE090
|
|
[Token(Token = "0x17001D4B")]
|
|
public string MacAlgOid
|
|
{
|
|
[Token(Token = "0x600BD00")]
|
|
[Address(RVA = "0x1660400", Offset = "0x165F200", VA = "0x181660400")]
|
|
get
|
|
{
|
|
Asn1Object asn1Object = this.macAlg.ToAsn1Object();
|
|
throw new NullReferenceException();
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001D4C RID: 7500
|
|
// (get) Token: 0x0600BD01 RID: 48385 RVA: 0x002AFEB0 File Offset: 0x002AE0B0
|
|
[Token(Token = "0x17001D4C")]
|
|
public Asn1Object MacAlgParams
|
|
{
|
|
[Token(Token = "0x600BD01")]
|
|
[Address(RVA = "0x1660440", Offset = "0x165F240", VA = "0x181660440")]
|
|
get
|
|
{
|
|
DerObjectIdentifier objectID = this.macAlg.ObjectID;
|
|
if (objectID == 0)
|
|
{
|
|
}
|
|
return objectID.ToAsn1Object();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600BD02 RID: 48386 RVA: 0x002AFEDC File Offset: 0x002AE0DC
|
|
[Token(Token = "0x600BD02")]
|
|
[Address(RVA = "0x3F6400", Offset = "0x3F5200", VA = "0x1803F6400")]
|
|
public RecipientInformationStore GetRecipientInfos()
|
|
{
|
|
return this._recipientInfoStore;
|
|
}
|
|
|
|
// Token: 0x0600BD03 RID: 48387 RVA: 0x002AFEF0 File Offset: 0x002AE0F0
|
|
[Token(Token = "0x600BD03")]
|
|
[Address(RVA = "0x165FDE0", Offset = "0x165EBE0", VA = "0x18165FDE0")]
|
|
public byte[] GetMac()
|
|
{
|
|
byte[] array = this.mac;
|
|
if (array == 0)
|
|
{
|
|
BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attributeTable = this.GetAuthAttrs();
|
|
Stream octetStream = this.authData.GetMac().GetOctetStream();
|
|
this.mac = octetStream;
|
|
}
|
|
return Arrays.Clone(array);
|
|
}
|
|
|
|
// Token: 0x0600BD04 RID: 48388 RVA: 0x002AFF34 File Offset: 0x002AE134
|
|
[Token(Token = "0x600BD04")]
|
|
[Address(RVA = "0x165FB20", Offset = "0x165E920", VA = "0x18165FB20")]
|
|
public BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable GetAuthAttrs()
|
|
{
|
|
while (this.authAttrs == (ulong)0L && this.authAttrNotRead)
|
|
{
|
|
Asn1SetParser asn1SetParser = this.authData.GetAuthAttrs();
|
|
this.authAttrNotRead = false;
|
|
if (asn1SetParser != 0)
|
|
{
|
|
int num = 0;
|
|
int num2 = 0;
|
|
if (num2 < num)
|
|
{
|
|
num2 += num2;
|
|
num2++;
|
|
}
|
|
Asn1EncodableVector asn1EncodableVector;
|
|
if (asn1EncodableVector != 0)
|
|
{
|
|
if (asn1EncodableVector == 0)
|
|
{
|
|
continue;
|
|
}
|
|
Asn1Encodable[] array = new Asn1Encodable[1];
|
|
num2 += num2;
|
|
num2++;
|
|
if (num2 != 0)
|
|
{
|
|
}
|
|
array[0] = num2;
|
|
asn1EncodableVector.Add(array);
|
|
array += array;
|
|
array += array;
|
|
}
|
|
BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attributeTable = new BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable(new DerSet(asn1EncodableVector));
|
|
this.authAttrs = attributeTable;
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
return this.authAttrs;
|
|
}
|
|
|
|
// Token: 0x0600BD05 RID: 48389 RVA: 0x002AFFE4 File Offset: 0x002AE1E4
|
|
[Token(Token = "0x600BD05")]
|
|
[Address(RVA = "0x165FE90", Offset = "0x165EC90", VA = "0x18165FE90")]
|
|
public BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable GetUnauthAttrs()
|
|
{
|
|
while (this.unauthAttrs == (ulong)0L && this.unauthAttrNotRead)
|
|
{
|
|
Asn1SetParser asn1SetParser = this.authData.GetUnauthAttrs();
|
|
this.unauthAttrNotRead = false;
|
|
if (asn1SetParser != 0)
|
|
{
|
|
int num = 0;
|
|
int num2 = 0;
|
|
if (num2 < num)
|
|
{
|
|
num2 += num2;
|
|
num2++;
|
|
}
|
|
Asn1EncodableVector asn1EncodableVector;
|
|
if (asn1EncodableVector != 0)
|
|
{
|
|
if (asn1EncodableVector == 0)
|
|
{
|
|
continue;
|
|
}
|
|
Asn1Encodable[] array = new Asn1Encodable[1];
|
|
num2 += num2;
|
|
num2++;
|
|
if (num2 != 0)
|
|
{
|
|
}
|
|
array[0] = num2;
|
|
asn1EncodableVector.Add(array);
|
|
array += array;
|
|
array += array;
|
|
}
|
|
BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable attributeTable = new BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable(new DerSet(asn1EncodableVector));
|
|
this.unauthAttrs = attributeTable;
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
return this.unauthAttrs;
|
|
}
|
|
|
|
// Token: 0x0400785D RID: 30813
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400785D")]
|
|
internal RecipientInformationStore _recipientInfoStore;
|
|
|
|
// Token: 0x0400785E RID: 30814
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400785E")]
|
|
internal AuthenticatedDataParser authData;
|
|
|
|
// Token: 0x0400785F RID: 30815
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400785F")]
|
|
private AlgorithmIdentifier macAlg;
|
|
|
|
// Token: 0x04007860 RID: 30816
|
|
[FieldOffset(Offset = "0x38")]
|
|
[Token(Token = "0x4007860")]
|
|
private byte[] mac;
|
|
|
|
// Token: 0x04007861 RID: 30817
|
|
[FieldOffset(Offset = "0x40")]
|
|
[Token(Token = "0x4007861")]
|
|
private BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable authAttrs;
|
|
|
|
// Token: 0x04007862 RID: 30818
|
|
[FieldOffset(Offset = "0x48")]
|
|
[Token(Token = "0x4007862")]
|
|
private BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable unauthAttrs;
|
|
|
|
// Token: 0x04007863 RID: 30819
|
|
[FieldOffset(Offset = "0x50")]
|
|
[Token(Token = "0x4007863")]
|
|
private bool authAttrNotRead;
|
|
|
|
// Token: 0x04007864 RID: 30820
|
|
[FieldOffset(Offset = "0x51")]
|
|
[Token(Token = "0x4007864")]
|
|
private bool unauthAttrNotRead;
|
|
}
|
|
}
|