Files
27Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/X509/X509V1CertificateGenerator.cs
T
niko c12fbe3fc6 m
2026-04-12 16:51:38 +02:00

223 lines
10 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 BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509
{
// Token: 0x020019EC RID: 6636
[Token(Token = "0x20019EC")]
public class X509V1CertificateGenerator
{
// Token: 0x06009AF0 RID: 39664 RVA: 0x001FB61C File Offset: 0x001F981C
[Token(Token = "0x6009AF0")]
[Address(RVA = "0x422B30", Offset = "0x421B30", VA = "0x180422B30")]
public X509V1CertificateGenerator()
{
V1TbsCertificateGenerator v1TbsCertificateGenerator = new V1TbsCertificateGenerator();
this.tbsGen = v1TbsCertificateGenerator;
}
// Token: 0x06009AF1 RID: 39665 RVA: 0x001FB63C File Offset: 0x001F983C
[Token(Token = "0x6009AF1")]
[Address(RVA = "0x4225C0", Offset = "0x4215C0", VA = "0x1804225C0")]
public void Reset()
{
V1TbsCertificateGenerator v1TbsCertificateGenerator = new V1TbsCertificateGenerator();
this.tbsGen = v1TbsCertificateGenerator;
}
// Token: 0x06009AF2 RID: 39666 RVA: 0x001FB658 File Offset: 0x001F9858
[Token(Token = "0x6009AF2")]
[Address(RVA = "0x4227E0", Offset = "0x4217E0", VA = "0x1804227E0")]
public void SetSerialNumber(BigInteger serialNumber)
{
/*
An exception occurred when decompiling this method (06009AF2)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509V1CertificateGenerator::SetSerialNumber(BestHTTP.SecureProtocol.Org.BouncyCastle.Math.BigInteger)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_25:
stloc:ArgumentException(var_2_34, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("serial number must be a positive integer"), ldstr:string("serialNumber")))
}
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.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1878
at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1846
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: 0x06009AF3 RID: 39667 RVA: 0x001FB69C File Offset: 0x001F989C
[Token(Token = "0x6009AF3")]
[Address(RVA = "0x422610", Offset = "0x421610", VA = "0x180422610")]
public void SetIssuerDN(X509Name issuer)
{
this.tbsGen.issuer = issuer;
}
// Token: 0x06009AF4 RID: 39668 RVA: 0x001FB6BC File Offset: 0x001F98BC
[Token(Token = "0x6009AF4")]
[Address(RVA = "0x4226A0", Offset = "0x4216A0", VA = "0x1804226A0")]
public void SetNotBefore(DateTime date)
{
V1TbsCertificateGenerator v1TbsCertificateGenerator = this.tbsGen;
Time time = new Time(date);
v1TbsCertificateGenerator.startDate = time;
}
// Token: 0x06009AF5 RID: 39669 RVA: 0x001FB6E4 File Offset: 0x001F98E4
[Token(Token = "0x6009AF5")]
[Address(RVA = "0x422630", Offset = "0x421630", VA = "0x180422630")]
public void SetNotAfter(DateTime date)
{
V1TbsCertificateGenerator v1TbsCertificateGenerator = this.tbsGen;
Time time = new Time(date);
v1TbsCertificateGenerator.endDate = time;
}
// Token: 0x06009AF6 RID: 39670 RVA: 0x001FB70C File Offset: 0x001F990C
[Token(Token = "0x6009AF6")]
[Address(RVA = "0x422B10", Offset = "0x421B10", VA = "0x180422B10")]
public void SetSubjectDN(X509Name subject)
{
this.tbsGen.subject = subject;
}
// Token: 0x06009AF7 RID: 39671 RVA: 0x001FB72C File Offset: 0x001F992C
[Token(Token = "0x6009AF7")]
[Address(RVA = "0x422710", Offset = "0x421710", VA = "0x180422710")]
public void SetPublicKey(AsymmetricKeyParameter publicKey)
{
V1TbsCertificateGenerator v1TbsCertificateGenerator = this.tbsGen;
SubjectPublicKeyInfo subjectPublicKeyInfo = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey);
v1TbsCertificateGenerator.subjectPublicKeyInfo = subjectPublicKeyInfo;
}
// Token: 0x06009AF8 RID: 39672 RVA: 0x001FB764 File Offset: 0x001F9964
[Token(Token = "0x6009AF8")]
[Address(RVA = "0x4228A0", Offset = "0x4218A0", VA = "0x1804228A0")]
[Obsolete]
public void SetSignatureAlgorithm(string signatureAlgorithm)
{
this.signatureAlgorithm = signatureAlgorithm;
string text = Platform.ToUpperInvariant(signatureAlgorithm);
IDictionary algorithms = X509Utilities.algorithms;
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(text);
IDictionary algorithms2 = X509Utilities.algorithms;
IDictionary algorithms3 = X509Utilities.algorithms;
AlgorithmIdentifier algorithmIdentifier;
this.sigAlgId = algorithmIdentifier;
this.tbsGen.signature = algorithmIdentifier;
}
// Token: 0x06009AF9 RID: 39673 RVA: 0x001FB7D4 File Offset: 0x001F99D4
[Token(Token = "0x6009AF9")]
[Address(RVA = "0x422220", Offset = "0x421220", VA = "0x180422220")]
[Obsolete]
public X509Certificate Generate(AsymmetricKeyParameter privateKey)
{
int num;
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, num);
num = 0;
return this.Generate(asn1SignatureFactory);
}
// Token: 0x06009AFA RID: 39674 RVA: 0x001FB7F8 File Offset: 0x001F99F8
[Token(Token = "0x6009AFA")]
[Address(RVA = "0x422180", Offset = "0x421180", VA = "0x180422180")]
[Obsolete]
public X509Certificate Generate(AsymmetricKeyParameter privateKey, SecureRandom random)
{
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, random);
return this.Generate(asn1SignatureFactory);
}
// Token: 0x06009AFB RID: 39675 RVA: 0x001FB81C File Offset: 0x001F9A1C
[Token(Token = "0x6009AFB")]
[Address(RVA = "0x4222B0", Offset = "0x4212B0", VA = "0x1804222B0")]
public X509Certificate Generate(ISignatureFactory signatureCalculatorFactory)
{
byte[] derEncoded;
for (;;)
{
V1TbsCertificateGenerator v1TbsCertificateGenerator = this.tbsGen;
if (signatureCalculatorFactory != 0)
{
derEncoded = this.tbsGen.GenerateTbsCertificate().GetDerEncoded();
if (derEncoded != 0 && derEncoded != 0)
{
if (derEncoded == 0)
{
}
if (derEncoded != 0)
{
break;
}
}
}
}
DerBitString derBitString = new DerBitString(derEncoded);
X509CertificateStructure x509CertificateStructure;
return new X509Certificate(x509CertificateStructure);
}
// Token: 0x06009AFC RID: 39676 RVA: 0x001FB878 File Offset: 0x001F9A78
[Token(Token = "0x6009AFC")]
[Address(RVA = "0x4220C0", Offset = "0x4210C0", VA = "0x1804220C0")]
private X509Certificate GenerateJcaObject(TbsCertificateStructure tbsCert, AlgorithmIdentifier sigAlg, byte[] signature)
{
DerBitString derBitString = new DerBitString(signature);
return new X509Certificate(new X509CertificateStructure(tbsCert, sigAlg, derBitString));
}
// Token: 0x170018B6 RID: 6326
// (get) Token: 0x06009AFD RID: 39677 RVA: 0x001FB89C File Offset: 0x001F9A9C
[Token(Token = "0x170018B6")]
public IEnumerable SignatureAlgNames
{
[Token(Token = "0x6009AFD")]
[Address(RVA = "0x422B90", Offset = "0x421B90", VA = "0x180422B90")]
get
{
IDictionary algorithms = X509Utilities.algorithms;
throw new NullReferenceException();
}
}
// Token: 0x04006861 RID: 26721
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x4006861")]
private V1TbsCertificateGenerator tbsGen;
// Token: 0x04006862 RID: 26722
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x4006862")]
private DerObjectIdentifier sigOID;
// Token: 0x04006863 RID: 26723
[FieldOffset(Offset = "0x20")]
[Token(Token = "0x4006863")]
private AlgorithmIdentifier sigAlgId;
// Token: 0x04006864 RID: 26724
[FieldOffset(Offset = "0x28")]
[Token(Token = "0x4006864")]
private string signatureAlgorithm;
}
}