253 lines
12 KiB
C#
253 lines
12 KiB
C#
using System;
|
|
using System.Collections;
|
|
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: 0x0200190E RID: 6414
|
|
[Token(Token = "0x200190E")]
|
|
public class X509V2AttributeCertificateGenerator
|
|
{
|
|
// Token: 0x0600974A RID: 38730 RVA: 0x001F2D74 File Offset: 0x001F0F74
|
|
[Token(Token = "0x600974A")]
|
|
[Address(RVA = "0x1C48B50", Offset = "0x1C47950", VA = "0x181C48B50")]
|
|
public X509V2AttributeCertificateGenerator()
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = new X509ExtensionsGenerator();
|
|
this.extGenerator = x509ExtensionsGenerator;
|
|
base..ctor();
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = new V2AttributeCertificateInfoGenerator();
|
|
this.acInfoGen = v2AttributeCertificateInfoGenerator;
|
|
}
|
|
|
|
// Token: 0x0600974B RID: 38731 RVA: 0x001F2DA4 File Offset: 0x001F0FA4
|
|
[Token(Token = "0x600974B")]
|
|
[Address(RVA = "0x1C487B0", Offset = "0x1C475B0", VA = "0x181C487B0")]
|
|
public void Reset()
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = new V2AttributeCertificateInfoGenerator();
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
this.acInfoGen = v2AttributeCertificateInfoGenerator;
|
|
x509ExtensionsGenerator.Reset();
|
|
}
|
|
|
|
// Token: 0x0600974C RID: 38732 RVA: 0x001F2DD4 File Offset: 0x001F0FD4
|
|
[Token(Token = "0x600974C")]
|
|
[Address(RVA = "0x1C48820", Offset = "0x1C47620", VA = "0x181C48820")]
|
|
public void SetHolder(AttributeCertificateHolder holder)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
Holder holder2 = holder.holder;
|
|
v2AttributeCertificateInfoGenerator.holder = holder2;
|
|
}
|
|
|
|
// Token: 0x0600974D RID: 38733 RVA: 0x001F2DFC File Offset: 0x001F0FFC
|
|
[Token(Token = "0x600974D")]
|
|
[Address(RVA = "0x1C488B0", Offset = "0x1C476B0", VA = "0x181C488B0")]
|
|
public void SetIssuer(AttributeCertificateIssuer issuer)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
AttCertIssuer instance = AttCertIssuer.GetInstance(issuer.form);
|
|
v2AttributeCertificateInfoGenerator.issuer = instance;
|
|
}
|
|
|
|
// Token: 0x0600974E RID: 38734 RVA: 0x001F2E2C File Offset: 0x001F102C
|
|
[Token(Token = "0x600974E")]
|
|
[Address(RVA = "0x1C489D0", Offset = "0x1C477D0", VA = "0x181C489D0")]
|
|
public void SetSerialNumber(BigInteger serialNumber)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerInteger derInteger = new DerInteger(serialNumber);
|
|
v2AttributeCertificateInfoGenerator.serialNumber = derInteger;
|
|
}
|
|
|
|
// Token: 0x0600974F RID: 38735 RVA: 0x001F2E54 File Offset: 0x001F1054
|
|
[Token(Token = "0x600974F")]
|
|
[Address(RVA = "0x1C48960", Offset = "0x1C47760", VA = "0x181C48960")]
|
|
public void SetNotBefore(DateTime date)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerGeneralizedTime derGeneralizedTime = new DerGeneralizedTime(date);
|
|
v2AttributeCertificateInfoGenerator.startDate = derGeneralizedTime;
|
|
}
|
|
|
|
// Token: 0x06009750 RID: 38736 RVA: 0x001F2E7C File Offset: 0x001F107C
|
|
[Token(Token = "0x6009750")]
|
|
[Address(RVA = "0x1C488F0", Offset = "0x1C476F0", VA = "0x181C488F0")]
|
|
public void SetNotAfter(DateTime date)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerGeneralizedTime derGeneralizedTime = new DerGeneralizedTime(date);
|
|
v2AttributeCertificateInfoGenerator.endDate = derGeneralizedTime;
|
|
}
|
|
|
|
// Token: 0x06009751 RID: 38737 RVA: 0x001F2EA4 File Offset: 0x001F10A4
|
|
[Token(Token = "0x6009751")]
|
|
[Address(RVA = "0x1C48A40", Offset = "0x1C47840", VA = "0x181C48A40")]
|
|
[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: 0x06009752 RID: 38738 RVA: 0x001F2EEC File Offset: 0x001F10EC
|
|
[Token(Token = "0x6009752")]
|
|
[Address(RVA = "0x1C48180", Offset = "0x1C46F80", VA = "0x181C48180")]
|
|
public void AddAttribute(X509Attribute attribute)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
AttributeX509 instance = AttributeX509.GetInstance(attribute.ToAsn1Object());
|
|
v2AttributeCertificateInfoGenerator.AddAttribute(instance);
|
|
}
|
|
|
|
// Token: 0x06009753 RID: 38739 RVA: 0x001F2F1C File Offset: 0x001F111C
|
|
[Token(Token = "0x6009753")]
|
|
[Address(RVA = "0x1C48850", Offset = "0x1C47650", VA = "0x181C48850")]
|
|
public void SetIssuerUniqueId(bool[] iui)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009753)
|
|
|
|
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: 0x06009754 RID: 38740 RVA: 0x001F2F34 File Offset: 0x001F1134
|
|
[Token(Token = "0x6009754")]
|
|
[Address(RVA = "0x1C481D0", Offset = "0x1C46FD0", VA = "0x181C481D0")]
|
|
public void AddExtension(string oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06009755 RID: 38741 RVA: 0x001F2F60 File Offset: 0x001F1160
|
|
[Token(Token = "0x6009755")]
|
|
[Address(RVA = "0x1C48280", Offset = "0x1C47080", VA = "0x181C48280")]
|
|
public void AddExtension(string oid, bool critical, byte[] extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06009756 RID: 38742 RVA: 0x001F2F8C File Offset: 0x001F118C
|
|
[Token(Token = "0x6009756")]
|
|
[Address(RVA = "0x1C48720", Offset = "0x1C47520", VA = "0x181C48720")]
|
|
[Obsolete]
|
|
public IX509AttributeCertificate Generate(AsymmetricKeyParameter privateKey)
|
|
{
|
|
int num;
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, num);
|
|
num = 0;
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06009757 RID: 38743 RVA: 0x001F2FB0 File Offset: 0x001F11B0
|
|
[Token(Token = "0x6009757")]
|
|
[Address(RVA = "0x1C48330", Offset = "0x1C47130", VA = "0x181C48330")]
|
|
[Obsolete]
|
|
public IX509AttributeCertificate Generate(AsymmetricKeyParameter privateKey, SecureRandom random)
|
|
{
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, random);
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06009758 RID: 38744 RVA: 0x001F2FD4 File Offset: 0x001F11D4
|
|
[Token(Token = "0x6009758")]
|
|
[Address(RVA = "0x1C483D0", Offset = "0x1C471D0", VA = "0x181C483D0")]
|
|
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: 0x17001822 RID: 6178
|
|
// (get) Token: 0x06009759 RID: 38745 RVA: 0x001F3074 File Offset: 0x001F1274
|
|
[Token(Token = "0x17001822")]
|
|
public IEnumerable SignatureAlgNames
|
|
{
|
|
[Token(Token = "0x6009759")]
|
|
[Address(RVA = "0x1C48BD0", Offset = "0x1C479D0", VA = "0x181C48BD0")]
|
|
get
|
|
{
|
|
return X509Utilities.GetAlgNames();
|
|
}
|
|
}
|
|
|
|
// Token: 0x040066AF RID: 26287
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40066AF")]
|
|
private readonly X509ExtensionsGenerator extGenerator;
|
|
|
|
// Token: 0x040066B0 RID: 26288
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40066B0")]
|
|
private V2AttributeCertificateInfoGenerator acInfoGen;
|
|
|
|
// Token: 0x040066B1 RID: 26289
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40066B1")]
|
|
private DerObjectIdentifier sigOID;
|
|
|
|
// Token: 0x040066B2 RID: 26290
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40066B2")]
|
|
private AlgorithmIdentifier sigAlgId;
|
|
|
|
// Token: 0x040066B3 RID: 26291
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x40066B3")]
|
|
private string signatureAlgorithm;
|
|
}
|
|
}
|