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: 0x020019EE RID: 6638
|
|
[Token(Token = "0x20019EE")]
|
|
public class X509V2AttributeCertificateGenerator
|
|
{
|
|
// Token: 0x06009B18 RID: 39704 RVA: 0x001FBE0C File Offset: 0x001FA00C
|
|
[Token(Token = "0x6009B18")]
|
|
[Address(RVA = "0x63C250", Offset = "0x63B250", VA = "0x18063C250")]
|
|
public X509V2AttributeCertificateGenerator()
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = new X509ExtensionsGenerator();
|
|
this.extGenerator = x509ExtensionsGenerator;
|
|
base..ctor();
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = new V2AttributeCertificateInfoGenerator();
|
|
this.acInfoGen = v2AttributeCertificateInfoGenerator;
|
|
}
|
|
|
|
// Token: 0x06009B19 RID: 39705 RVA: 0x001FBE3C File Offset: 0x001FA03C
|
|
[Token(Token = "0x6009B19")]
|
|
[Address(RVA = "0x63BEB0", Offset = "0x63AEB0", VA = "0x18063BEB0")]
|
|
public void Reset()
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = new V2AttributeCertificateInfoGenerator();
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
this.acInfoGen = v2AttributeCertificateInfoGenerator;
|
|
x509ExtensionsGenerator.Reset();
|
|
}
|
|
|
|
// Token: 0x06009B1A RID: 39706 RVA: 0x001FBE6C File Offset: 0x001FA06C
|
|
[Token(Token = "0x6009B1A")]
|
|
[Address(RVA = "0x63BF20", Offset = "0x63AF20", VA = "0x18063BF20")]
|
|
public void SetHolder(AttributeCertificateHolder holder)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
Holder holder2 = holder.holder;
|
|
v2AttributeCertificateInfoGenerator.holder = holder2;
|
|
}
|
|
|
|
// Token: 0x06009B1B RID: 39707 RVA: 0x001FBE94 File Offset: 0x001FA094
|
|
[Token(Token = "0x6009B1B")]
|
|
[Address(RVA = "0x63BFB0", Offset = "0x63AFB0", VA = "0x18063BFB0")]
|
|
public void SetIssuer(AttributeCertificateIssuer issuer)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
AttCertIssuer instance = AttCertIssuer.GetInstance(issuer.form);
|
|
v2AttributeCertificateInfoGenerator.issuer = instance;
|
|
}
|
|
|
|
// Token: 0x06009B1C RID: 39708 RVA: 0x001FBEC4 File Offset: 0x001FA0C4
|
|
[Token(Token = "0x6009B1C")]
|
|
[Address(RVA = "0x63C0D0", Offset = "0x63B0D0", VA = "0x18063C0D0")]
|
|
public void SetSerialNumber(BigInteger serialNumber)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerInteger derInteger = new DerInteger(serialNumber);
|
|
v2AttributeCertificateInfoGenerator.serialNumber = derInteger;
|
|
}
|
|
|
|
// Token: 0x06009B1D RID: 39709 RVA: 0x001FBEEC File Offset: 0x001FA0EC
|
|
[Token(Token = "0x6009B1D")]
|
|
[Address(RVA = "0x63C060", Offset = "0x63B060", VA = "0x18063C060")]
|
|
public void SetNotBefore(DateTime date)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerGeneralizedTime derGeneralizedTime = new DerGeneralizedTime(date);
|
|
v2AttributeCertificateInfoGenerator.startDate = derGeneralizedTime;
|
|
}
|
|
|
|
// Token: 0x06009B1E RID: 39710 RVA: 0x001FBF14 File Offset: 0x001FA114
|
|
[Token(Token = "0x6009B1E")]
|
|
[Address(RVA = "0x63BFF0", Offset = "0x63AFF0", VA = "0x18063BFF0")]
|
|
public void SetNotAfter(DateTime date)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
DerGeneralizedTime derGeneralizedTime = new DerGeneralizedTime(date);
|
|
v2AttributeCertificateInfoGenerator.endDate = derGeneralizedTime;
|
|
}
|
|
|
|
// Token: 0x06009B1F RID: 39711 RVA: 0x001FBF3C File Offset: 0x001FA13C
|
|
[Token(Token = "0x6009B1F")]
|
|
[Address(RVA = "0x63C140", Offset = "0x63B140", VA = "0x18063C140")]
|
|
[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: 0x06009B20 RID: 39712 RVA: 0x001FBF84 File Offset: 0x001FA184
|
|
[Token(Token = "0x6009B20")]
|
|
[Address(RVA = "0x63B880", Offset = "0x63A880", VA = "0x18063B880")]
|
|
public void AddAttribute(X509Attribute attribute)
|
|
{
|
|
V2AttributeCertificateInfoGenerator v2AttributeCertificateInfoGenerator = this.acInfoGen;
|
|
AttributeX509 instance = AttributeX509.GetInstance(attribute.ToAsn1Object());
|
|
v2AttributeCertificateInfoGenerator.AddAttribute(instance);
|
|
}
|
|
|
|
// Token: 0x06009B21 RID: 39713 RVA: 0x001FBFB4 File Offset: 0x001FA1B4
|
|
[Token(Token = "0x6009B21")]
|
|
[Address(RVA = "0x63BF50", Offset = "0x63AF50", VA = "0x18063BF50")]
|
|
public void SetIssuerUniqueId(bool[] iui)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009B21)
|
|
|
|
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: 0x06009B22 RID: 39714 RVA: 0x001FBFCC File Offset: 0x001FA1CC
|
|
[Token(Token = "0x6009B22")]
|
|
[Address(RVA = "0x63B8D0", Offset = "0x63A8D0", VA = "0x18063B8D0")]
|
|
public void AddExtension(string oid, bool critical, Asn1Encodable extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06009B23 RID: 39715 RVA: 0x001FBFF8 File Offset: 0x001FA1F8
|
|
[Token(Token = "0x6009B23")]
|
|
[Address(RVA = "0x63B980", Offset = "0x63A980", VA = "0x18063B980")]
|
|
public void AddExtension(string oid, bool critical, byte[] extensionValue)
|
|
{
|
|
X509ExtensionsGenerator x509ExtensionsGenerator = this.extGenerator;
|
|
DerObjectIdentifier derObjectIdentifier = new DerObjectIdentifier(oid);
|
|
x509ExtensionsGenerator.AddExtension(derObjectIdentifier, critical, extensionValue);
|
|
}
|
|
|
|
// Token: 0x06009B24 RID: 39716 RVA: 0x001FC024 File Offset: 0x001FA224
|
|
[Token(Token = "0x6009B24")]
|
|
[Address(RVA = "0x63BE20", Offset = "0x63AE20", VA = "0x18063BE20")]
|
|
[Obsolete]
|
|
public IX509AttributeCertificate Generate(AsymmetricKeyParameter privateKey)
|
|
{
|
|
int num;
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, num);
|
|
num = 0;
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06009B25 RID: 39717 RVA: 0x001FC048 File Offset: 0x001FA248
|
|
[Token(Token = "0x6009B25")]
|
|
[Address(RVA = "0x63BA30", Offset = "0x63AA30", VA = "0x18063BA30")]
|
|
[Obsolete]
|
|
public IX509AttributeCertificate Generate(AsymmetricKeyParameter privateKey, SecureRandom random)
|
|
{
|
|
Asn1SignatureFactory asn1SignatureFactory = new Asn1SignatureFactory(this.signatureAlgorithm, privateKey, random);
|
|
return this.Generate(asn1SignatureFactory);
|
|
}
|
|
|
|
// Token: 0x06009B26 RID: 39718 RVA: 0x001FC06C File Offset: 0x001FA26C
|
|
[Token(Token = "0x6009B26")]
|
|
[Address(RVA = "0x63BAD0", Offset = "0x63AAD0", VA = "0x18063BAD0")]
|
|
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: 0x170018BF RID: 6335
|
|
// (get) Token: 0x06009B27 RID: 39719 RVA: 0x001FC10C File Offset: 0x001FA30C
|
|
[Token(Token = "0x170018BF")]
|
|
public IEnumerable SignatureAlgNames
|
|
{
|
|
[Token(Token = "0x6009B27")]
|
|
[Address(RVA = "0x63C2D0", Offset = "0x63B2D0", VA = "0x18063C2D0")]
|
|
get
|
|
{
|
|
return X509Utilities.GetAlgNames();
|
|
}
|
|
}
|
|
|
|
// Token: 0x04006868 RID: 26728
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006868")]
|
|
private readonly X509ExtensionsGenerator extGenerator;
|
|
|
|
// Token: 0x04006869 RID: 26729
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006869")]
|
|
private V2AttributeCertificateInfoGenerator acInfoGen;
|
|
|
|
// Token: 0x0400686A RID: 26730
|
|
[FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x400686A")]
|
|
private DerObjectIdentifier sigOID;
|
|
|
|
// Token: 0x0400686B RID: 26731
|
|
[FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x400686B")]
|
|
private AlgorithmIdentifier sigAlgId;
|
|
|
|
// Token: 0x0400686C RID: 26732
|
|
[FieldOffset(Offset = "0x30")]
|
|
[Token(Token = "0x400686C")]
|
|
private string signatureAlgorithm;
|
|
}
|
|
}
|