255 lines
12 KiB
C#
255 lines
12 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: 0x02001331 RID: 4913
|
|
[Token(Token = "0x2001331")]
|
|
[StructLayout(3)]
|
|
public class X509V2AttributeCertificateGenerator
|
|
{
|
|
// Token: 0x06007B70 RID: 31600 RVA: 0x0019B38C File Offset: 0x0019958C
|
|
[Token(Token = "0x6007B70")]
|
|
[Address(RVA = "0x53B330", Offset = "0x539D30", VA = "0x18053B330")]
|
|
public X509V2AttributeCertificateGenerator()
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = new X509ExtensionsGenerator();
|
|
this.extGenerator = x509ExtensionsGenerator;
|
|
base..ctor();
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = new V2AttributeCertificateInfoGenerator();
|
|
this.acInfoGen = v2AttributeCertificateInfoGenerator;
|
|
}
|
|
|
|
// Token: 0x06007B71 RID: 31601 RVA: 0x0019B3BC File Offset: 0x001995BC
|
|
[Token(Token = "0x6007B71")]
|
|
[Address(RVA = "0x53AF90", Offset = "0x539990", VA = "0x18053AF90")]
|
|
public void Reset()
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = new V2AttributeCertificateInfoGenerator();
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
this.acInfoGen = v2AttributeCertificateInfoGenerator;
|
|
x509ExtensionsGenerator.Reset();
|
|
}
|
|
|
|
// Token: 0x06007B72 RID: 31602 RVA: 0x0019B3EC File Offset: 0x001995EC
|
|
[Token(Token = "0x6007B72")]
|
|
[Address(RVA = "0x53B000", Offset = "0x539A00", VA = "0x18053B000")]
|
|
public void SetHolder(AttributeCertificateHolder holder)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
Holder holder2 = holder.holder;
|
|
v2AttributeCertificateInfoGenerator.holder = holder2;
|
|
}
|
|
|
|
// Token: 0x06007B73 RID: 31603 RVA: 0x0019B414 File Offset: 0x00199614
|
|
[Token(Token = "0x6007B73")]
|
|
[Address(RVA = "0x53B090", Offset = "0x539A90", VA = "0x18053B090")]
|
|
public void SetIssuer(AttributeCertificateIssuer issuer)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
AttCertIssuer instance = AttCertIssuer.GetInstance(issuer.form);
|
|
v2AttributeCertificateInfoGenerator.issuer = instance;
|
|
}
|
|
|
|
// Token: 0x06007B74 RID: 31604 RVA: 0x0019B444 File Offset: 0x00199644
|
|
[Token(Token = "0x6007B74")]
|
|
[Address(RVA = "0x53B1B0", Offset = "0x539BB0", VA = "0x18053B1B0")]
|
|
public void SetSerialNumber(BigInteger serialNumber)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerInteger derInteger = new DerInteger(serialNumber);
|
|
v2AttributeCertificateInfoGenerator.serialNumber = derInteger;
|
|
}
|
|
|
|
// Token: 0x06007B75 RID: 31605 RVA: 0x0019B46C File Offset: 0x0019966C
|
|
[Token(Token = "0x6007B75")]
|
|
[Address(RVA = "0x53B140", Offset = "0x539B40", VA = "0x18053B140")]
|
|
public void SetNotBefore(DateTime date)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerGeneralizedTime derGeneralizedTime = new DerGeneralizedTime(date);
|
|
v2AttributeCertificateInfoGenerator.startDate = derGeneralizedTime;
|
|
}
|
|
|
|
// Token: 0x06007B76 RID: 31606 RVA: 0x0019B494 File Offset: 0x00199694
|
|
[Token(Token = "0x6007B76")]
|
|
[Address(RVA = "0x53B0D0", Offset = "0x539AD0", VA = "0x18053B0D0")]
|
|
public void SetNotAfter(DateTime date)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerGeneralizedTime derGeneralizedTime = new DerGeneralizedTime(date);
|
|
v2AttributeCertificateInfoGenerator.endDate = derGeneralizedTime;
|
|
}
|
|
|
|
// Token: 0x06007B77 RID: 31607 RVA: 0x0019B4BC File Offset: 0x001996BC
|
|
[Token(Token = "0x6007B77")]
|
|
[Address(RVA = "0x53B220", Offset = "0x539C20", VA = "0x18053B220")]
|
|
[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.acInfoGen.signature = sigAlgID;
|
|
}
|
|
|
|
// Token: 0x06007B78 RID: 31608 RVA: 0x0019B504 File Offset: 0x00199704
|
|
[Token(Token = "0x6007B78")]
|
|
[Address(RVA = "0x53A960", Offset = "0x539360", VA = "0x18053A960")]
|
|
public void AddAttribute(X509Attribute attribute)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
AttributeX509 instance = AttributeX509.GetInstance(attribute.ToAsn1Object());
|
|
v2AttributeCertificateInfoGenerator.AddAttribute(instance);
|
|
}
|
|
|
|
// Token: 0x06007B79 RID: 31609 RVA: 0x0019B534 File Offset: 0x00199734
|
|
[Token(Token = "0x6007B79")]
|
|
[Address(RVA = "0x53B030", Offset = "0x539A30", VA = "0x18053B030")]
|
|
public void SetIssuerUniqueId(bool[] iui)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06007B79)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509V2AttributeCertificateGenerator::SetIssuerUniqueId(System.Boolean[])
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
Block_0:
|
|
stloc:Exception(var_0_0A, call:Exception(Platform::CreateNotImplementedException, ldstr:string("SetIssuerUniqueId()")))
|
|
}
|
|
|
|
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: 0x06007B7A RID: 31610 RVA: 0x0019B54C File Offset: 0x0019974C
|
|
[Token(Token = "0x6007B7A")]
|
|
[Address(RVA = "0x53A9B0", Offset = "0x5393B0", VA = "0x18053A9B0")]
|
|
public void AddExtension(string oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06007B7B RID: 31611 RVA: 0x0019B578 File Offset: 0x00199778
|
|
[Token(Token = "0x6007B7B")]
|
|
[Address(RVA = "0x53AA60", Offset = "0x539460", VA = "0x18053AA60")]
|
|
public void AddExtension(string oid, bool critical, byte[] extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06007B7C RID: 31612 RVA: 0x0019B5A4 File Offset: 0x001997A4
|
|
[Token(Token = "0x6007B7C")]
|
|
[Address(RVA = "0x53AF00", Offset = "0x539900", VA = "0x18053AF00")]
|
|
[Obsolete]
|
|
public IX509AttributeCertificate Generate(AsymmetricKeyParameter privateKey)
|
|
{
|
|
int num;
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, num);
|
|
num = 0;
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06007B7D RID: 31613 RVA: 0x0019B5C8 File Offset: 0x001997C8
|
|
[Token(Token = "0x6007B7D")]
|
|
[Address(RVA = "0x53AB10", Offset = "0x539510", VA = "0x18053AB10")]
|
|
[Obsolete]
|
|
public IX509AttributeCertificate Generate(AsymmetricKeyParameter privateKey, SecureRandom random)
|
|
{
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, random);
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06007B7E RID: 31614 RVA: 0x0019B5EC File Offset: 0x001997EC
|
|
[Token(Token = "0x6007B7E")]
|
|
[Address(RVA = "0x53ABB0", Offset = "0x5395B0", VA = "0x18053ABB0")]
|
|
public IX509AttributeCertificate Generate(ISignatureFactory signatureCalculatorFactory)
|
|
{
|
|
bool isEmpty;
|
|
do
|
|
{
|
|
isEmpty = this.extGenerator.IsEmpty;
|
|
if (!isEmpty)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
X509Extensions x509Extensions = this.extGenerator.Generate();
|
|
v2AttributeCertificateInfoGenerator.extensions = x509Extensions;
|
|
}
|
|
if (!isEmpty)
|
|
{
|
|
}
|
|
}
|
|
while (!isEmpty);
|
|
this.acInfoGen.signature = isEmpty;
|
|
byte[] derEncoded = this.acInfoGen.GenerateAttributeCertificateInfo().GetDerEncoded();
|
|
if (derEncoded != 0 && derEncoded != 0)
|
|
{
|
|
DerBitString derBitString = new DerBitString(derEncoded);
|
|
AttributeCertificate attributeCertificate;
|
|
X509V2AttributeCertificate x509V2AttributeCertificate = new X509V2AttributeCertificate(attributeCertificate);
|
|
throw new NullReferenceException();
|
|
}
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x17001421 RID: 5153
|
|
// (get) Token: 0x06007B7F RID: 31615 RVA: 0x0019B68C File Offset: 0x0019988C
|
|
[Token(Token = "0x17001421")]
|
|
public IEnumerable SignatureAlgNames
|
|
{
|
|
[Token(Token = "0x6007B7F")]
|
|
[Address(RVA = "0x53B3B0", Offset = "0x539DB0", VA = "0x18053B3B0")]
|
|
get
|
|
{
|
|
return X509Utilities.GetAlgNames();
|
|
}
|
|
}
|
|
|
|
// Token: 0x0400586C RID: 22636
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x400586C")]
|
|
private readonly X509ExtensionsGenerator extGenerator;
|
|
|
|
// Token: 0x0400586D RID: 22637
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x400586D")]
|
|
private V2AttributeCertificateInfoGenerator acInfoGen;
|
|
|
|
// Token: 0x0400586E RID: 22638
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400586E")]
|
|
private DerObjectIdentifier sigOID;
|
|
|
|
// Token: 0x0400586F RID: 22639
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400586F")]
|
|
private AlgorithmIdentifier sigAlgId;
|
|
|
|
// Token: 0x04005870 RID: 22640
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x4005870")]
|
|
private string signatureAlgorithm;
|
|
}
|
|
}
|