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: 0x020019EB RID: 6635
|
|
[Token(Token = "0x20019EB")]
|
|
internal class X509Utilities
|
|
{
|
|
// Token: 0x06009AE9 RID: 39657 RVA: 0x001FB144 File Offset: 0x001F9344
|
|
[Token(Token = "0x6009AE9")]
|
|
[Address(RVA = "0x420D70", Offset = "0x41FD70", VA = "0x180420D70")]
|
|
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: 0x06009AEA RID: 39658 RVA: 0x001FB4F4 File Offset: 0x001F96F4
|
|
[Token(Token = "0x6009AEA")]
|
|
[Address(RVA = "0x420640", Offset = "0x41F640", VA = "0x180420640")]
|
|
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: 0x06009AEB RID: 39659 RVA: 0x001FB524 File Offset: 0x001F9724
|
|
[Token(Token = "0x6009AEB")]
|
|
[Address(RVA = "0x420810", Offset = "0x41F810", VA = "0x180420810")]
|
|
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: 0x06009AEC RID: 39660 RVA: 0x001FB560 File Offset: 0x001F9760
|
|
[Token(Token = "0x6009AEC")]
|
|
[Address(RVA = "0x420990", Offset = "0x41F990", VA = "0x180420990")]
|
|
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: 0x06009AED RID: 39661 RVA: 0x001FB5B8 File Offset: 0x001F97B8
|
|
[Token(Token = "0x6009AED")]
|
|
[Address(RVA = "0x420760", Offset = "0x41F760", VA = "0x180420760")]
|
|
internal static IEnumerable GetAlgNames()
|
|
{
|
|
IDictionary dictionary = X509Utilities.algorithms;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009AEE RID: 39662 RVA: 0x001FB5D0 File Offset: 0x001F97D0
|
|
[Token(Token = "0x6009AEE")]
|
|
[Address(RVA = "0x420C00", Offset = "0x41FC00", VA = "0x180420C00")]
|
|
internal static byte[] GetSignatureForObject(DerObjectIdentifier sigOid, string sigName, AsymmetricKeyParameter privateKey, SecureRandom random, Asn1Encodable ae)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06009AEE)
|
|
|
|
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 1663
|
|
*/;
|
|
}
|
|
|
|
// Token: 0x06009AEF RID: 39663 RVA: 0x001FB608 File Offset: 0x001F9808
|
|
[Token(Token = "0x6009AEF")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
public X509Utilities()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0400685E RID: 26718
|
|
[Token(Token = "0x400685E")]
|
|
private static readonly IDictionary algorithms;
|
|
|
|
// Token: 0x0400685F RID: 26719
|
|
[Token(Token = "0x400685F")]
|
|
private static readonly IDictionary exParams;
|
|
|
|
// Token: 0x04006860 RID: 26720
|
|
[Token(Token = "0x4006860")]
|
|
private static readonly ISet noParams;
|
|
}
|
|
}
|