313 lines
13 KiB
C#
313 lines
13 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Operators;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509
|
|
{
|
|
// Token: 0x02001332 RID: 4914
|
|
[Token(Token = "0x2001332")]
|
|
[StructLayout(3)]
|
|
public class X509V2CrlGenerator
|
|
{
|
|
// Token: 0x06007B80 RID: 31616 RVA: 0x0019B6A0 File Offset: 0x001998A0
|
|
[Token(Token = "0x6007B80")]
|
|
[Address(RVA = "0x53D630", Offset = "0x53C030", VA = "0x18053D630")]
|
|
public X509V2CrlGenerator()
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = new X509ExtensionsGenerator();
|
|
this.extGenerator = x509ExtensionsGenerator;
|
|
base..ctor();
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = new V2TbsCertListGenerator();
|
|
this.tbsGen = v2TbsCertListGenerator;
|
|
}
|
|
|
|
// Token: 0x06007B81 RID: 31617 RVA: 0x0019B6D0 File Offset: 0x001998D0
|
|
[Token(Token = "0x6007B81")]
|
|
[Address(RVA = "0x53D3B0", Offset = "0x53BDB0", VA = "0x18053D3B0")]
|
|
public void Reset()
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = new V2TbsCertListGenerator();
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
this.tbsGen = v2TbsCertListGenerator;
|
|
x509ExtensionsGenerator.Reset();
|
|
}
|
|
|
|
// Token: 0x06007B82 RID: 31618 RVA: 0x0019B700 File Offset: 0x00199900
|
|
[Token(Token = "0x6007B82")]
|
|
[Address(RVA = "0x53D420", Offset = "0x53BE20", VA = "0x18053D420")]
|
|
public void SetIssuerDN(X509Name issuer)
|
|
{
|
|
this.tbsGen.issuer = issuer;
|
|
}
|
|
|
|
// Token: 0x06007B83 RID: 31619 RVA: 0x0019B720 File Offset: 0x00199920
|
|
[Token(Token = "0x6007B83")]
|
|
[Address(RVA = "0x53D5C0", Offset = "0x53BFC0", VA = "0x18053D5C0")]
|
|
public void SetThisUpdate(DateTime date)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
Time time = new Time(date);
|
|
v2TbsCertListGenerator.thisUpdate = time;
|
|
}
|
|
|
|
// Token: 0x06007B84 RID: 31620 RVA: 0x0019B748 File Offset: 0x00199948
|
|
[Token(Token = "0x6007B84")]
|
|
[Address(RVA = "0x53D440", Offset = "0x53BE40", VA = "0x18053D440")]
|
|
public void SetNextUpdate(DateTime date)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
Time time = new Time(date);
|
|
v2TbsCertListGenerator.nextUpdate = time;
|
|
}
|
|
|
|
// Token: 0x06007B85 RID: 31621 RVA: 0x0019B770 File Offset: 0x00199970
|
|
[Token(Token = "0x6007B85")]
|
|
[Address(RVA = "0x53C770", Offset = "0x53B170", VA = "0x18053C770")]
|
|
public void AddCrlEntry(BigInteger userCertificate, DateTime revocationDate, int reason)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
DerInteger derInteger = new DerInteger(userCertificate);
|
|
Time time = new Time(revocationDate);
|
|
v2TbsCertListGenerator.AddCrlEntry(derInteger, time, reason);
|
|
}
|
|
|
|
// Token: 0x06007B86 RID: 31622 RVA: 0x0019B7A4 File Offset: 0x001999A4
|
|
[Token(Token = "0x6007B86")]
|
|
[Address(RVA = "0x53C830", Offset = "0x53B230", VA = "0x18053C830")]
|
|
public void AddCrlEntry(BigInteger userCertificate, DateTime revocationDate, int reason, DateTime invalidityDate)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
DerInteger derInteger = new DerInteger(userCertificate);
|
|
Time time = new Time(revocationDate);
|
|
}
|
|
|
|
// Token: 0x06007B87 RID: 31623 RVA: 0x0019B7CC File Offset: 0x001999CC
|
|
[Token(Token = "0x6007B87")]
|
|
[Address(RVA = "0x53C6B0", Offset = "0x53B0B0", VA = "0x18053C6B0")]
|
|
public void AddCrlEntry(BigInteger userCertificate, DateTime revocationDate, X509Extensions extensions)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
DerInteger derInteger = new DerInteger(userCertificate);
|
|
Time time = new Time(revocationDate);
|
|
v2TbsCertListGenerator.AddCrlEntry(derInteger, time, extensions);
|
|
}
|
|
|
|
// Token: 0x06007B88 RID: 31624 RVA: 0x0019B800 File Offset: 0x00199A00
|
|
[Token(Token = "0x6007B88")]
|
|
[Address(RVA = "0x53C920", Offset = "0x53B320", VA = "0x18053C920")]
|
|
public void AddCrl(X509Crl other)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06007B88)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509V2CrlGenerator::AddCrl(BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509Crl)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_4C:
|
|
stloc:ArgumentNullException(var_5_56, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("other")))
|
|
}
|
|
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1852
|
|
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 355
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
|
|
--- End of inner exception stack trace ---
|
|
at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
|
|
at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x06007B89 RID: 31625 RVA: 0x0019B864 File Offset: 0x00199A64
|
|
[Token(Token = "0x6007B89")]
|
|
[Address(RVA = "0x53D4B0", Offset = "0x53BEB0", VA = "0x18053D4B0")]
|
|
[Obsolete]
|
|
public void SetSignatureAlgorithm(string signatureAlgorithm)
|
|
{
|
|
this.signatureAlgorithm = signatureAlgorithm;
|
|
DerObjectIdentifier algorithmOid = X509Utilities.GetAlgorithmOid(signatureAlgorithm);
|
|
this.sigOID = algorithmOid;
|
|
AlgorithmIdentifier sigAlgID = X509Utilities.GetSigAlgID(algorithmOid, signatureAlgorithm);
|
|
this.sigAlgId = sigAlgID;
|
|
this.tbsGen.signature = sigAlgID;
|
|
}
|
|
|
|
// Token: 0x06007B8A RID: 31626 RVA: 0x0019B8B0 File Offset: 0x00199AB0
|
|
[Token(Token = "0x6007B8A")]
|
|
[Address(RVA = "0x53CCD0", Offset = "0x53B6D0", VA = "0x18053CCD0")]
|
|
public void AddExtension(string oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06007B8B RID: 31627 RVA: 0x0019B8DC File Offset: 0x00199ADC
|
|
[Token(Token = "0x6007B8B")]
|
|
[Address(RVA = "0x53CB30", Offset = "0x53B530", VA = "0x18053CB30")]
|
|
public void AddExtension(DerObjectIdentifier oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
this.extGenerator.AddExtension(oid, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06007B8C RID: 31628 RVA: 0x0019B900 File Offset: 0x00199B00
|
|
[Token(Token = "0x6007B8C")]
|
|
[Address(RVA = "0x53CC10", Offset = "0x53B610", VA = "0x18053CC10")]
|
|
public void AddExtension(string oid, bool critical, byte[] extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
DerOctetString derOctetString = new DerOctetString(extensionValue);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, derOctetString);
|
|
}
|
|
|
|
// Token: 0x06007B8D RID: 31629 RVA: 0x0019B934 File Offset: 0x00199B34
|
|
[Token(Token = "0x6007B8D")]
|
|
[Address(RVA = "0x53CB60", Offset = "0x53B560", VA = "0x18053CB60")]
|
|
public void AddExtension(DerObjectIdentifier oid, bool critical, byte[] extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerOctetString derOctetString = new DerOctetString(extensionValue);
|
|
x509ExtensionsGenerator.AddExtension(oid, critical, derOctetString);
|
|
}
|
|
|
|
// Token: 0x06007B8E RID: 31630 RVA: 0x0019B960 File Offset: 0x00199B60
|
|
[Token(Token = "0x6007B8E")]
|
|
[Address(RVA = "0x53D320", Offset = "0x53BD20", VA = "0x18053D320")]
|
|
[Obsolete]
|
|
public X509Crl Generate(AsymmetricKeyParameter privateKey)
|
|
{
|
|
int num;
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, num);
|
|
num = 0;
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06007B8F RID: 31631 RVA: 0x0019B984 File Offset: 0x00199B84
|
|
[Token(Token = "0x6007B8F")]
|
|
[Address(RVA = "0x53CFA0", Offset = "0x53B9A0", VA = "0x18053CFA0")]
|
|
[Obsolete]
|
|
public X509Crl Generate(AsymmetricKeyParameter privateKey, SecureRandom random)
|
|
{
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, random);
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06007B90 RID: 31632 RVA: 0x0019B9A8 File Offset: 0x00199BA8
|
|
[Token(Token = "0x6007B90")]
|
|
[Address(RVA = "0x53D040", Offset = "0x53BA40", VA = "0x18053D040")]
|
|
public X509Crl Generate(ISignatureFactory signatureCalculatorFactory)
|
|
{
|
|
for (;;)
|
|
{
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
if (signatureCalculatorFactory != 0)
|
|
{
|
|
if (!this.extGenerator.IsEmpty)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
V2TbsCertListGenerator v2TbsCertListGenerator2 = this.tbsGen;
|
|
X509Extensions x509Extensions = x509ExtensionsGenerator.Generate();
|
|
v2TbsCertListGenerator2.extensions = x509Extensions;
|
|
}
|
|
byte[] derEncoded = this.tbsGen.GenerateTbsCertList().GetDerEncoded();
|
|
if (derEncoded != 0 && derEncoded != 0)
|
|
{
|
|
if (derEncoded == 0)
|
|
{
|
|
}
|
|
if (derEncoded != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
X509Crl x509Crl;
|
|
return x509Crl;
|
|
}
|
|
|
|
// Token: 0x06007B91 RID: 31633 RVA: 0x0019BA2C File Offset: 0x00199C2C
|
|
[Token(Token = "0x6007B91")]
|
|
[Address(RVA = "0x53CD80", Offset = "0x53B780", VA = "0x18053CD80")]
|
|
private TbsCertificateList GenerateCertList()
|
|
{
|
|
if (!this.extGenerator.IsEmpty)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
V2TbsCertListGenerator v2TbsCertListGenerator = this.tbsGen;
|
|
X509Extensions x509Extensions = x509ExtensionsGenerator.Generate();
|
|
v2TbsCertListGenerator.extensions = x509Extensions;
|
|
}
|
|
return this.tbsGen.GenerateTbsCertList();
|
|
}
|
|
|
|
// Token: 0x06007B92 RID: 31634 RVA: 0x0019BA74 File Offset: 0x00199C74
|
|
[Token(Token = "0x6007B92")]
|
|
[Address(RVA = "0x53CDE0", Offset = "0x53B7E0", VA = "0x18053CDE0")]
|
|
private X509Crl GenerateJcaObject(TbsCertificateList tbsCrl, AlgorithmIdentifier algId, byte[] signature)
|
|
{
|
|
Asn1Encodable[] array = new Asn1Encodable[3];
|
|
if (tbsCrl != 0)
|
|
{
|
|
}
|
|
array[0] = tbsCrl;
|
|
if (algId != 0)
|
|
{
|
|
}
|
|
array[1] = algId;
|
|
DerBitString derBitString = new DerBitString(signature);
|
|
if (derBitString != 0)
|
|
{
|
|
}
|
|
array[2] = derBitString;
|
|
return new X509Crl(CertificateList.GetInstance(new DerSequence(array)));
|
|
}
|
|
|
|
// Token: 0x17001422 RID: 5154
|
|
// (get) Token: 0x06007B93 RID: 31635 RVA: 0x0019BACC File Offset: 0x00199CCC
|
|
[Token(Token = "0x17001422")]
|
|
public IEnumerable SignatureAlgNames
|
|
{
|
|
[Token(Token = "0x6007B93")]
|
|
[Address(RVA = "0x53D6B0", Offset = "0x53C0B0", VA = "0x18053D6B0")]
|
|
get
|
|
{
|
|
return X509Utilities.GetAlgNames();
|
|
}
|
|
}
|
|
|
|
// Token: 0x04005871 RID: 22641
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4005871")]
|
|
private readonly X509ExtensionsGenerator extGenerator;
|
|
|
|
// Token: 0x04005872 RID: 22642
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4005872")]
|
|
private V2TbsCertListGenerator tbsGen;
|
|
|
|
// Token: 0x04005873 RID: 22643
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x4005873")]
|
|
private DerObjectIdentifier sigOID;
|
|
|
|
// Token: 0x04005874 RID: 22644
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x4005874")]
|
|
private AlgorithmIdentifier sigAlgId;
|
|
|
|
// Token: 0x04005875 RID: 22645
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4005875")]
|
|
private string signatureAlgorithm;
|
|
}
|
|
}
|