121 lines
4.4 KiB
C#
121 lines
4.4 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
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.Crypto;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.X509;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
|
|
{
|
|
// Token: 0x0200177E RID: 6014
|
|
[Token(Token = "0x200177E")]
|
|
[StructLayout(3)]
|
|
internal class KeyTransRecipientInfoGenerator : RecipientInfoGenerator
|
|
{
|
|
// Token: 0x0600A285 RID: 41605 RVA: 0x0025DC08 File Offset: 0x0025BE08
|
|
[Token(Token = "0x600A285")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
internal KeyTransRecipientInfoGenerator()
|
|
{
|
|
}
|
|
|
|
// Token: 0x17001978 RID: 6520
|
|
// (set) Token: 0x0600A286 RID: 41606 RVA: 0x0025DC1C File Offset: 0x0025BE1C
|
|
[Token(Token = "0x17001978")]
|
|
internal X509Certificate RecipientCert
|
|
{
|
|
[Token(Token = "0x600A286")]
|
|
[Address(RVA = "0x6609B0", Offset = "0x65F3B0", VA = "0x1806609B0")]
|
|
set
|
|
{
|
|
TbsCertificateStructure tbsCertificateStructure = CmsUtilities.GetTbsCertificateStructure(value);
|
|
this.recipientTbsCert = tbsCertificateStructure;
|
|
ICollection collection;
|
|
this.recipientPublicKey = collection;
|
|
SubjectPublicKeyInfo subjectPublicKeyInfo = this.recipientTbsCert.subjectPublicKeyInfo;
|
|
this.info = subjectPublicKeyInfo;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17001979 RID: 6521
|
|
// (set) Token: 0x0600A287 RID: 41607 RVA: 0x0025DC58 File Offset: 0x0025BE58
|
|
[Token(Token = "0x17001979")]
|
|
internal AsymmetricKeyParameter RecipientPublicKey
|
|
{
|
|
[Token(Token = "0x600A287")]
|
|
[Address(RVA = "0x660A10", Offset = "0x65F410", VA = "0x180660A10")]
|
|
set
|
|
{
|
|
this.recipientPublicKey = value;
|
|
SubjectPublicKeyInfo subjectPublicKeyInfo = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(this.recipientPublicKey);
|
|
this.info = subjectPublicKeyInfo;
|
|
}
|
|
}
|
|
|
|
// Token: 0x1700197A RID: 6522
|
|
// (set) Token: 0x0600A288 RID: 41608 RVA: 0x0025DC8C File Offset: 0x0025BE8C
|
|
[Token(Token = "0x1700197A")]
|
|
internal Asn1OctetString SubjectKeyIdentifier
|
|
{
|
|
[Token(Token = "0x600A288")]
|
|
[Address(RVA = "0x3C1260", Offset = "0x3BFC60", VA = "0x1803C1260")]
|
|
set
|
|
{
|
|
this.subjectKeyIdentifier = value;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600A289 RID: 41609 RVA: 0x0025DCA0 File Offset: 0x0025BEA0
|
|
[Token(Token = "0x600A289")]
|
|
[Address(RVA = "0x6606E0", Offset = "0x65F0E0", VA = "0x1806606E0", Slot = "4")]
|
|
public RecipientInfo Generate(KeyParameter contentEncryptionKey, SecureRandom random)
|
|
{
|
|
byte[] key = contentEncryptionKey.GetKey();
|
|
AlgorithmIdentifier algID = this.info.algID;
|
|
CmsEnvelopedHelper helper = KeyTransRecipientInfoGenerator.Helper;
|
|
Asn1Object asn1Object = algID.ToAsn1Object();
|
|
ParametersWithRandom parametersWithRandom = new ParametersWithRandom(this.recipientPublicKey, random);
|
|
int length = key.Length;
|
|
TbsCertificateStructure tbsCertificateStructure = this.recipientTbsCert;
|
|
if (tbsCertificateStructure == 0)
|
|
{
|
|
RecipientIdentifier recipientIdentifier = new RecipientIdentifier(this.subjectKeyIdentifier);
|
|
}
|
|
X509Name issuer = tbsCertificateStructure.issuer;
|
|
BigInteger value = tbsCertificateStructure.serialNumber.Value;
|
|
DerOctetString derOctetString;
|
|
return new RecipientInfo(new KeyTransRecipientInfo(new RecipientIdentifier(new IssuerAndSerialNumber(issuer, value)), algID, derOctetString));
|
|
}
|
|
|
|
// Token: 0x04006AE0 RID: 27360
|
|
[Token(Token = "0x4006AE0")]
|
|
private static readonly CmsEnvelopedHelper Helper = CmsEnvelopedHelper.Instance;
|
|
|
|
// Token: 0x04006AE1 RID: 27361
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006AE1")]
|
|
private TbsCertificateStructure recipientTbsCert;
|
|
|
|
// Token: 0x04006AE2 RID: 27362
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006AE2")]
|
|
private AsymmetricKeyParameter recipientPublicKey;
|
|
|
|
// Token: 0x04006AE3 RID: 27363
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4006AE3")]
|
|
private Asn1OctetString subjectKeyIdentifier;
|
|
|
|
// Token: 0x04006AE4 RID: 27364
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4006AE4")]
|
|
private SubjectPublicKeyInfo info;
|
|
}
|
|
}
|