256 lines
15 KiB
C#
256 lines
15 KiB
C#
using System;
|
|
using System.Collections;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.CryptoPro;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Nist;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Oiw;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.TeleTrust;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X9;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Collections;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.X509
|
|
{
|
|
// Token: 0x0200190B RID: 6411
|
|
[Token(Token = "0x200190B")]
|
|
internal class X509Utilities
|
|
{
|
|
// Token: 0x0600971B RID: 38683 RVA: 0x001F20AC File Offset: 0x001F02AC
|
|
[Token(Token = "0x600971B")]
|
|
[Address(RVA = "0x1633960", Offset = "0x1632760", VA = "0x181633960")]
|
|
static X509Utilities()
|
|
{
|
|
IDictionary dictionary = Platform.CreateHashtable();
|
|
X509Utilities.algorithms = dictionary;
|
|
X509Utilities.exParams = Platform.CreateHashtable();
|
|
X509Utilities.noParams = new HashSet();
|
|
IDictionary dictionary2 = X509Utilities.algorithms;
|
|
DerObjectIdentifier md2WithRsaEncryption = PkcsObjectIdentifiers.MD2WithRsaEncryption;
|
|
IDictionary dictionary3 = X509Utilities.algorithms;
|
|
DerObjectIdentifier md2WithRsaEncryption2 = PkcsObjectIdentifiers.MD2WithRsaEncryption;
|
|
IDictionary dictionary4 = X509Utilities.algorithms;
|
|
DerObjectIdentifier md5WithRsaEncryption = PkcsObjectIdentifiers.MD5WithRsaEncryption;
|
|
IDictionary dictionary5 = X509Utilities.algorithms;
|
|
DerObjectIdentifier md5WithRsaEncryption2 = PkcsObjectIdentifiers.MD5WithRsaEncryption;
|
|
IDictionary dictionary6 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha1WithRsaEncryption = PkcsObjectIdentifiers.Sha1WithRsaEncryption;
|
|
IDictionary dictionary7 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha1WithRsaEncryption2 = PkcsObjectIdentifiers.Sha1WithRsaEncryption;
|
|
IDictionary dictionary8 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha224WithRsaEncryption = PkcsObjectIdentifiers.Sha224WithRsaEncryption;
|
|
IDictionary dictionary9 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha224WithRsaEncryption2 = PkcsObjectIdentifiers.Sha224WithRsaEncryption;
|
|
IDictionary dictionary10 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha256WithRsaEncryption = PkcsObjectIdentifiers.Sha256WithRsaEncryption;
|
|
IDictionary dictionary11 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha256WithRsaEncryption2 = PkcsObjectIdentifiers.Sha256WithRsaEncryption;
|
|
IDictionary dictionary12 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha384WithRsaEncryption = PkcsObjectIdentifiers.Sha384WithRsaEncryption;
|
|
IDictionary dictionary13 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha384WithRsaEncryption2 = PkcsObjectIdentifiers.Sha384WithRsaEncryption;
|
|
IDictionary dictionary14 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha512WithRsaEncryption = PkcsObjectIdentifiers.Sha512WithRsaEncryption;
|
|
IDictionary dictionary15 = X509Utilities.algorithms;
|
|
DerObjectIdentifier sha512WithRsaEncryption2 = PkcsObjectIdentifiers.Sha512WithRsaEncryption;
|
|
IDictionary dictionary16 = X509Utilities.algorithms;
|
|
DerObjectIdentifier idRsassaPss = PkcsObjectIdentifiers.IdRsassaPss;
|
|
IDictionary dictionary17 = X509Utilities.algorithms;
|
|
DerObjectIdentifier idRsassaPss2 = PkcsObjectIdentifiers.IdRsassaPss;
|
|
IDictionary dictionary18 = X509Utilities.algorithms;
|
|
DerObjectIdentifier idRsassaPss3 = PkcsObjectIdentifiers.IdRsassaPss;
|
|
IDictionary dictionary19 = X509Utilities.algorithms;
|
|
DerObjectIdentifier idRsassaPss4 = PkcsObjectIdentifiers.IdRsassaPss;
|
|
IDictionary dictionary20 = X509Utilities.algorithms;
|
|
DerObjectIdentifier idRsassaPss5 = PkcsObjectIdentifiers.IdRsassaPss;
|
|
IDictionary dictionary21 = X509Utilities.algorithms;
|
|
DerObjectIdentifier rsaSignatureWithRipeMD = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160;
|
|
IDictionary dictionary22 = X509Utilities.algorithms;
|
|
DerObjectIdentifier rsaSignatureWithRipeMD2 = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD160;
|
|
IDictionary dictionary23 = X509Utilities.algorithms;
|
|
DerObjectIdentifier rsaSignatureWithRipeMD3 = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128;
|
|
IDictionary dictionary24 = X509Utilities.algorithms;
|
|
DerObjectIdentifier rsaSignatureWithRipeMD4 = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD128;
|
|
IDictionary dictionary25 = X509Utilities.algorithms;
|
|
DerObjectIdentifier rsaSignatureWithRipeMD5 = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256;
|
|
IDictionary dictionary26 = X509Utilities.algorithms;
|
|
DerObjectIdentifier rsaSignatureWithRipeMD6 = TeleTrusTObjectIdentifiers.RsaSignatureWithRipeMD256;
|
|
IDictionary dictionary27 = X509Utilities.algorithms;
|
|
DerObjectIdentifier idDsaWithSha = X9ObjectIdentifiers.IdDsaWithSha1;
|
|
IDictionary dictionary28 = X509Utilities.algorithms;
|
|
DerObjectIdentifier idDsaWithSha2 = X9ObjectIdentifiers.IdDsaWithSha1;
|
|
IDictionary dictionary29 = X509Utilities.algorithms;
|
|
DerObjectIdentifier dsaWithSha = NistObjectIdentifiers.DsaWithSha224;
|
|
IDictionary dictionary30 = X509Utilities.algorithms;
|
|
DerObjectIdentifier dsaWithSha2 = NistObjectIdentifiers.DsaWithSha256;
|
|
IDictionary dictionary31 = X509Utilities.algorithms;
|
|
DerObjectIdentifier dsaWithSha3 = NistObjectIdentifiers.DsaWithSha384;
|
|
IDictionary dictionary32 = X509Utilities.algorithms;
|
|
DerObjectIdentifier dsaWithSha4 = NistObjectIdentifiers.DsaWithSha512;
|
|
IDictionary dictionary33 = X509Utilities.algorithms;
|
|
DerObjectIdentifier ecdsaWithSha = X9ObjectIdentifiers.ECDsaWithSha1;
|
|
IDictionary dictionary34 = X509Utilities.algorithms;
|
|
DerObjectIdentifier ecdsaWithSha2 = X9ObjectIdentifiers.ECDsaWithSha1;
|
|
IDictionary dictionary35 = X509Utilities.algorithms;
|
|
DerObjectIdentifier ecdsaWithSha3 = X9ObjectIdentifiers.ECDsaWithSha224;
|
|
IDictionary dictionary36 = X509Utilities.algorithms;
|
|
DerObjectIdentifier ecdsaWithSha4 = X9ObjectIdentifiers.ECDsaWithSha256;
|
|
IDictionary dictionary37 = X509Utilities.algorithms;
|
|
DerObjectIdentifier ecdsaWithSha5 = X9ObjectIdentifiers.ECDsaWithSha384;
|
|
IDictionary dictionary38 = X509Utilities.algorithms;
|
|
DerObjectIdentifier ecdsaWithSha6 = X9ObjectIdentifiers.ECDsaWithSha512;
|
|
IDictionary dictionary39 = X509Utilities.algorithms;
|
|
DerObjectIdentifier gostR3411x94WithGostR3410x = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94;
|
|
IDictionary dictionary40 = X509Utilities.algorithms;
|
|
DerObjectIdentifier gostR3411x94WithGostR3410x2 = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x94;
|
|
IDictionary dictionary41 = X509Utilities.algorithms;
|
|
DerObjectIdentifier gostR3411x94WithGostR3410x3 = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001;
|
|
IDictionary dictionary42 = X509Utilities.algorithms;
|
|
DerObjectIdentifier gostR3411x94WithGostR3410x4 = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001;
|
|
IDictionary dictionary43 = X509Utilities.algorithms;
|
|
DerObjectIdentifier gostR3411x94WithGostR3410x5 = CryptoProObjectIdentifiers.GostR3411x94WithGostR3410x2001;
|
|
ISet set = X509Utilities.noParams;
|
|
ISet set2 = X509Utilities.noParams;
|
|
ISet set3 = X509Utilities.noParams;
|
|
ISet set4 = X509Utilities.noParams;
|
|
ISet set5 = X509Utilities.noParams;
|
|
ISet set6 = X509Utilities.noParams;
|
|
ISet set7 = X509Utilities.noParams;
|
|
ISet set8 = X509Utilities.noParams;
|
|
ISet set9 = X509Utilities.noParams;
|
|
ISet set10 = X509Utilities.noParams;
|
|
ISet set11 = X509Utilities.noParams;
|
|
ISet set12 = X509Utilities.noParams;
|
|
DerObjectIdentifier idSha = OiwObjectIdentifiers.IdSha1;
|
|
DerNull instance = DerNull.Instance;
|
|
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(idSha, instance);
|
|
IDictionary dictionary44 = X509Utilities.exParams;
|
|
RsassaPssParameters rsassaPssParameters = X509Utilities.CreatePssParams(algorithmIdentifier, 20);
|
|
DerObjectIdentifier idSha2 = NistObjectIdentifiers.IdSha224;
|
|
DerNull instance2 = DerNull.Instance;
|
|
AlgorithmIdentifier algorithmIdentifier2 = new AlgorithmIdentifier(idSha2, instance2);
|
|
IDictionary dictionary45 = X509Utilities.exParams;
|
|
RsassaPssParameters rsassaPssParameters2 = X509Utilities.CreatePssParams(algorithmIdentifier2, 28);
|
|
DerObjectIdentifier idSha3 = NistObjectIdentifiers.IdSha256;
|
|
DerNull instance3 = DerNull.Instance;
|
|
AlgorithmIdentifier algorithmIdentifier3 = new AlgorithmIdentifier(idSha3, instance3);
|
|
IDictionary dictionary46 = X509Utilities.exParams;
|
|
RsassaPssParameters rsassaPssParameters3 = X509Utilities.CreatePssParams(algorithmIdentifier3, 32);
|
|
DerObjectIdentifier idSha4 = NistObjectIdentifiers.IdSha384;
|
|
DerNull instance4 = DerNull.Instance;
|
|
AlgorithmIdentifier algorithmIdentifier4 = new AlgorithmIdentifier(idSha4, instance4);
|
|
IDictionary dictionary47 = X509Utilities.exParams;
|
|
RsassaPssParameters rsassaPssParameters4 = X509Utilities.CreatePssParams(algorithmIdentifier4, 48);
|
|
DerObjectIdentifier idSha5 = NistObjectIdentifiers.IdSha512;
|
|
DerNull instance5 = DerNull.Instance;
|
|
AlgorithmIdentifier algorithmIdentifier5 = new AlgorithmIdentifier(idSha5, instance5);
|
|
IDictionary dictionary48 = X509Utilities.exParams;
|
|
RsassaPssParameters rsassaPssParameters5 = X509Utilities.CreatePssParams(algorithmIdentifier5, 64);
|
|
}
|
|
|
|
// Token: 0x0600971C RID: 38684 RVA: 0x001F245C File Offset: 0x001F065C
|
|
[Token(Token = "0x600971C")]
|
|
[Address(RVA = "0x1633230", Offset = "0x1632030", VA = "0x181633230")]
|
|
private static RsassaPssParameters CreatePssParams(AlgorithmIdentifier hashAlgId, int saltSize)
|
|
{
|
|
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(PkcsObjectIdentifiers.IdMgf1, hashAlgId);
|
|
DerInteger derInteger = new DerInteger(saltSize);
|
|
DerInteger derInteger2 = new DerInteger(1);
|
|
return new RsassaPssParameters(hashAlgId, algorithmIdentifier, derInteger, derInteger2);
|
|
}
|
|
|
|
// Token: 0x0600971D RID: 38685 RVA: 0x001F248C File Offset: 0x001F068C
|
|
[Token(Token = "0x600971D")]
|
|
[Address(RVA = "0x1633400", Offset = "0x1632200", VA = "0x181633400")]
|
|
internal static DerObjectIdentifier GetAlgorithmOid(string algorithmName)
|
|
{
|
|
string text = Platform.ToUpperInvariant(algorithmName);
|
|
IDictionary dictionary = X509Utilities.algorithms;
|
|
if (text == 0)
|
|
{
|
|
return new DerObjectIdentifier(text);
|
|
}
|
|
IDictionary dictionary2 = X509Utilities.algorithms;
|
|
IDictionary dictionary3 = X509Utilities.algorithms;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x0600971E RID: 38686 RVA: 0x001F24C8 File Offset: 0x001F06C8
|
|
[Token(Token = "0x600971E")]
|
|
[Address(RVA = "0x1633580", Offset = "0x1632380", VA = "0x181633580")]
|
|
internal static AlgorithmIdentifier GetSigAlgID(DerObjectIdentifier sigOid, string algorithmName)
|
|
{
|
|
ISet set = X509Utilities.noParams;
|
|
string text = Platform.ToUpperInvariant(algorithmName);
|
|
IDictionary dictionary = X509Utilities.exParams;
|
|
if (text == 0)
|
|
{
|
|
DerNull instance = DerNull.Instance;
|
|
return new AlgorithmIdentifier(sigOid, instance);
|
|
}
|
|
IDictionary dictionary2 = X509Utilities.exParams;
|
|
AlgorithmIdentifier algorithmIdentifier = new AlgorithmIdentifier(sigOid);
|
|
IDictionary dictionary3 = X509Utilities.algorithms;
|
|
return new AlgorithmIdentifier(sigOid);
|
|
}
|
|
|
|
// Token: 0x0600971F RID: 38687 RVA: 0x001F2520 File Offset: 0x001F0720
|
|
[Token(Token = "0x600971F")]
|
|
[Address(RVA = "0x1633350", Offset = "0x1632150", VA = "0x181633350")]
|
|
internal static IEnumerable GetAlgNames()
|
|
{
|
|
IDictionary dictionary = X509Utilities.algorithms;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009720 RID: 38688 RVA: 0x001F2538 File Offset: 0x001F0738
|
|
[Token(Token = "0x6009720")]
|
|
[Address(RVA = "0x16337F0", Offset = "0x16325F0", VA = "0x1816337F0")]
|
|
internal static byte[] GetSignatureForObject(DerObjectIdentifier sigOid, string sigName, AsymmetricKeyParameter privateKey, SecureRandom random, Asn1Encodable ae)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009720)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509Utilities::GetSignatureForObject(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.DerObjectIdentifier,System.String,BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.AsymmetricKeyParameter,BestHTTP.SecureProtocol.Org.BouncyCastle.Security.SecureRandom,BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Asn1Encodable)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_1E:
|
|
stloc:ArgumentNullException(var_5_28, newobj:ArgumentNullException(ArgumentNullException::.ctor, ldstr:string("sigOid")))
|
|
}
|
|
|
|
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 1660
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x06009721 RID: 38689 RVA: 0x001F2570 File Offset: 0x001F0770
|
|
[Token(Token = "0x6009721")]
|
|
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
|
public X509Utilities()
|
|
{
|
|
}
|
|
|
|
// Token: 0x040066A5 RID: 26277
|
|
[Token(Token = "0x40066A5")]
|
|
private static readonly IDictionary algorithms;
|
|
|
|
// Token: 0x040066A6 RID: 26278
|
|
[Token(Token = "0x40066A6")]
|
|
private static readonly IDictionary exParams;
|
|
|
|
// Token: 0x040066A7 RID: 26279
|
|
[Token(Token = "0x40066A7")]
|
|
private static readonly ISet noParams;
|
|
}
|
|
}
|