using System; using System.Collections; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.CryptoPro; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.GM; 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.Rosstandart; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.TeleTrust; using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509; using BestHTTP.SecureProtocol.Org.BouncyCastle.Cms; 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 BestHTTP.SecureProtocol.Org.BouncyCastle.X509; using Cpp2IlInjected; namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Tsp { // Token: 0x02001A47 RID: 6727 [Token(Token = "0x2001A47")] public class TspUtil { // Token: 0x06009E57 RID: 40535 RVA: 0x00208DE8 File Offset: 0x00206FE8 [Token(Token = "0x6009E57")] [Address(RVA = "0x4F2E40", Offset = "0x4F1E40", VA = "0x1804F2E40")] static TspUtil() { HashSet hashSet = new HashSet(); Hashtable hashtable = new Hashtable(); hashSet.impl = hashtable; UnmodifiableSetProxy unmodifiableSetProxy; unmodifiableSetProxy.s = hashSet; TspUtil.EmptySet = unmodifiableSetProxy; ArrayList arrayList = new ArrayList(); UnmodifiableListProxy unmodifiableListProxy; unmodifiableListProxy.l = arrayList; TspUtil.EmptyList = unmodifiableListProxy; TspUtil.digestLengths = new Hashtable(); TspUtil.digestNames = new Hashtable(); IDictionary dictionary = TspUtil.digestLengths; DerObjectIdentifier md = PkcsObjectIdentifiers.MD5; IDictionary dictionary2 = TspUtil.digestLengths; DerObjectIdentifier idSha = OiwObjectIdentifiers.IdSha1; IDictionary dictionary3 = TspUtil.digestLengths; DerObjectIdentifier idSha2 = NistObjectIdentifiers.IdSha224; IDictionary dictionary4 = TspUtil.digestLengths; DerObjectIdentifier idSha3 = NistObjectIdentifiers.IdSha256; IDictionary dictionary5 = TspUtil.digestLengths; DerObjectIdentifier idSha4 = NistObjectIdentifiers.IdSha384; IDictionary dictionary6 = TspUtil.digestLengths; DerObjectIdentifier idSha5 = NistObjectIdentifiers.IdSha512; IDictionary dictionary7 = TspUtil.digestLengths; DerObjectIdentifier ripeMD = TeleTrusTObjectIdentifiers.RipeMD128; IDictionary dictionary8 = TspUtil.digestLengths; DerObjectIdentifier ripeMD2 = TeleTrusTObjectIdentifiers.RipeMD160; IDictionary dictionary9 = TspUtil.digestLengths; DerObjectIdentifier ripeMD3 = TeleTrusTObjectIdentifiers.RipeMD256; IDictionary dictionary10 = TspUtil.digestLengths; DerObjectIdentifier gostR = CryptoProObjectIdentifiers.GostR3411; IDictionary dictionary11 = TspUtil.digestLengths; DerObjectIdentifier id_tc26_gost_3411_12_ = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_256; IDictionary dictionary12 = TspUtil.digestLengths; DerObjectIdentifier id_tc26_gost_3411_12_2 = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512; IDictionary dictionary13 = TspUtil.digestLengths; DerObjectIdentifier sm = GMObjectIdentifiers.sm3; IDictionary dictionary14 = TspUtil.digestNames; DerObjectIdentifier md2 = PkcsObjectIdentifiers.MD5; IDictionary dictionary15 = TspUtil.digestNames; DerObjectIdentifier idSha6 = OiwObjectIdentifiers.IdSha1; IDictionary dictionary16 = TspUtil.digestNames; DerObjectIdentifier idSha7 = NistObjectIdentifiers.IdSha224; IDictionary dictionary17 = TspUtil.digestNames; DerObjectIdentifier idSha8 = NistObjectIdentifiers.IdSha256; IDictionary dictionary18 = TspUtil.digestNames; DerObjectIdentifier idSha9 = NistObjectIdentifiers.IdSha384; IDictionary dictionary19 = TspUtil.digestNames; DerObjectIdentifier idSha10 = NistObjectIdentifiers.IdSha512; IDictionary dictionary20 = TspUtil.digestNames; DerObjectIdentifier md5WithRsaEncryption = PkcsObjectIdentifiers.MD5WithRsaEncryption; IDictionary dictionary21 = TspUtil.digestNames; DerObjectIdentifier sha1WithRsaEncryption = PkcsObjectIdentifiers.Sha1WithRsaEncryption; IDictionary dictionary22 = TspUtil.digestNames; DerObjectIdentifier sha224WithRsaEncryption = PkcsObjectIdentifiers.Sha224WithRsaEncryption; IDictionary dictionary23 = TspUtil.digestNames; DerObjectIdentifier sha256WithRsaEncryption = PkcsObjectIdentifiers.Sha256WithRsaEncryption; IDictionary dictionary24 = TspUtil.digestNames; DerObjectIdentifier sha384WithRsaEncryption = PkcsObjectIdentifiers.Sha384WithRsaEncryption; IDictionary dictionary25 = TspUtil.digestNames; DerObjectIdentifier sha512WithRsaEncryption = PkcsObjectIdentifiers.Sha512WithRsaEncryption; IDictionary dictionary26 = TspUtil.digestNames; DerObjectIdentifier ripeMD4 = TeleTrusTObjectIdentifiers.RipeMD128; IDictionary dictionary27 = TspUtil.digestNames; DerObjectIdentifier ripeMD5 = TeleTrusTObjectIdentifiers.RipeMD160; IDictionary dictionary28 = TspUtil.digestNames; DerObjectIdentifier ripeMD6 = TeleTrusTObjectIdentifiers.RipeMD256; IDictionary dictionary29 = TspUtil.digestNames; DerObjectIdentifier gostR2 = CryptoProObjectIdentifiers.GostR3411; IDictionary dictionary30 = TspUtil.digestNames; DerObjectIdentifier dsaWithSha = OiwObjectIdentifiers.DsaWithSha1; IDictionary dictionary31 = TspUtil.digestNames; DerObjectIdentifier sha1WithRsa = OiwObjectIdentifiers.Sha1WithRsa; IDictionary dictionary32 = TspUtil.digestNames; DerObjectIdentifier md5WithRsa = OiwObjectIdentifiers.MD5WithRsa; IDictionary dictionary33 = TspUtil.digestNames; DerObjectIdentifier id_tc26_gost_3411_12_3 = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_256; IDictionary dictionary34 = TspUtil.digestNames; DerObjectIdentifier id_tc26_gost_3411_12_4 = RosstandartObjectIdentifiers.id_tc26_gost_3411_12_512; IDictionary dictionary35 = TspUtil.digestNames; DerObjectIdentifier sm2 = GMObjectIdentifiers.sm3; } // Token: 0x06009E58 RID: 40536 RVA: 0x00209030 File Offset: 0x00207230 [Token(Token = "0x6009E58")] [Address(RVA = "0x4F25B0", Offset = "0x4F15B0", VA = "0x1804F25B0")] public static ICollection GetSignatureTimestamps(SignerInformation signerInfo) { byte[] array; do { ArrayList arrayList = new ArrayList(); BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.AttributeTable unsignedAttributes = signerInfo.UnsignedAttributes; if (unsignedAttributes == 0) { break; } DerObjectIdentifier idAASignatureTimeStampToken = PkcsObjectIdentifiers.IdAASignatureTimeStampToken; IEnumerator enumerator = unsignedAttributes.GetAll(idAASignatureTimeStampToken).GetEnumerator(); if (enumerator != 0) { if (enumerator == 0 || enumerator == 0) { goto IL_EF; } BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.ContentInfo contentInfo; TimeStampTokenInfo tstInfo = new TimeStampToken(contentInfo).tstInfo; byte[] array2; array = DigestUtilities.CalculateDigest(TspUtil.GetDigestAlgName(tstInfo.MessageImprintAlgOid), array2); byte[] messageImprintDigest = tstInfo.GetMessageImprintDigest(); if (!Arrays.ConstantTimeAreEqual(array, messageImprintDigest)) { goto IL_A7; } if ((uint)(-1) != 0U) { } if (array != 0) { goto IL_E9; } while ((ulong)((uint)(-1)) == (ulong)(-1L)) { } } if ((uint)(-1) != 0U) { } } while (array != 0); throw new NullReferenceException(); IL_A7: TspValidationException ex = new TspValidationException("Incorrect digest in message imprint"); throw new NullReferenceException(); IL_E9: throw new NullReferenceException(); IL_EF: throw new NullReferenceException(); } // Token: 0x06009E59 RID: 40537 RVA: 0x00209138 File Offset: 0x00207338 [Token(Token = "0x6009E59")] [Address(RVA = "0x4F2B60", Offset = "0x4F1B60", VA = "0x1804F2B60")] public static void ValidateCertificate(X509Certificate cert) { /* An exception occurred when decompiling this method (06009E59) ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BestHTTP.SecureProtocol.Org.BouncyCastle.Tsp.TspUtil::ValidateCertificate(BestHTTP.SecureProtocol.Org.BouncyCastle.X509.X509Certificate) ---> System.Exception: Basic block has to end with unconditional control flow. { IL_57: stloc:TspValidationException(var_6_61, newobj:TspValidationException(TspValidationException::.ctor, ldstr:string("Certificate must have an ExtendedKeyUsage extension marked as critical."))) } 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: 0x06009E5A RID: 40538 RVA: 0x002091A8 File Offset: 0x002073A8 [Token(Token = "0x6009E5A")] [Address(RVA = "0x4F21D0", Offset = "0x4F11D0", VA = "0x1804F21D0")] internal static string GetDigestAlgName(string digestAlgOID) { IDictionary dictionary = TspUtil.digestNames; return digestAlgOID; } // Token: 0x06009E5B RID: 40539 RVA: 0x002091C4 File Offset: 0x002073C4 [Token(Token = "0x6009E5B")] [Address(RVA = "0x4F2280", Offset = "0x4F1280", VA = "0x1804F2280")] internal static int GetDigestLength(string digestAlgOID) { IDictionary dictionary = TspUtil.digestLengths; IDictionary dictionary2 = TspUtil.digestLengths; ISet emptySet = TspUtil.EmptySet; throw new NullReferenceException(); } // Token: 0x06009E5C RID: 40540 RVA: 0x002091F8 File Offset: 0x002073F8 [Token(Token = "0x6009E5C")] [Address(RVA = "0x4F2070", Offset = "0x4F1070", VA = "0x1804F2070")] internal static IDigest CreateDigestInstance(string digestAlgOID) { return DigestUtilities.GetDigest(TspUtil.GetDigestAlgName(digestAlgOID)); } // Token: 0x06009E5D RID: 40541 RVA: 0x00209210 File Offset: 0x00207410 [Token(Token = "0x6009E5D")] [Address(RVA = "0x4F20F0", Offset = "0x4F10F0", VA = "0x1804F20F0")] internal static ISet GetCriticalExtensionOids(X509Extensions extensions) { if (extensions != 0) { HashSet hashSet = new HashSet(extensions.GetCriticalExtensionOids()); UnmodifiableSetProxy unmodifiableSetProxy; unmodifiableSetProxy.s = hashSet; } return TspUtil.EmptySet; } // Token: 0x06009E5E RID: 40542 RVA: 0x0020923C File Offset: 0x0020743C [Token(Token = "0x6009E5E")] [Address(RVA = "0x4F24D0", Offset = "0x4F14D0", VA = "0x1804F24D0")] internal static ISet GetNonCriticalExtensionOids(X509Extensions extensions) { if (extensions != 0) { HashSet hashSet = new HashSet(extensions.GetNonCriticalExtensionOids()); UnmodifiableSetProxy unmodifiableSetProxy; unmodifiableSetProxy.s = hashSet; } return TspUtil.EmptySet; } // Token: 0x06009E5F RID: 40543 RVA: 0x00209268 File Offset: 0x00207468 [Token(Token = "0x6009E5F")] [Address(RVA = "0x4F23B0", Offset = "0x4F13B0", VA = "0x1804F23B0")] internal static IList GetExtensionOids(X509Extensions extensions) { if (extensions != 0) { ArrayList arrayList = new ArrayList(extensions.GetExtensionOids()); UnmodifiableListProxy unmodifiableListProxy; unmodifiableListProxy.l = arrayList; } return TspUtil.EmptyList; } // Token: 0x06009E60 RID: 40544 RVA: 0x00209294 File Offset: 0x00207494 [Token(Token = "0x6009E60")] [Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")] public TspUtil() { } // Token: 0x04006A63 RID: 27235 [Token(Token = "0x4006A63")] private static ISet EmptySet; // Token: 0x04006A64 RID: 27236 [Token(Token = "0x4006A64")] private static IList EmptyList; // Token: 0x04006A65 RID: 27237 [Token(Token = "0x4006A65")] private static readonly IDictionary digestLengths; // Token: 0x04006A66 RID: 27238 [Token(Token = "0x4006A66")] private static readonly IDictionary digestNames; } }