This commit is contained in:
niko
2026-04-12 16:51:38 +02:00
parent 1b6f6d81d0
commit c12fbe3fc6
17828 changed files with 2994770 additions and 0 deletions
@@ -0,0 +1,146 @@
using System;
using System.IO;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Security
{
// Token: 0x02001A91 RID: 6801
[Token(Token = "0x2001A91")]
public sealed class PrivateKeyFactory
{
// Token: 0x0600A0F1 RID: 41201 RVA: 0x002180D0 File Offset: 0x002162D0
[Token(Token = "0x600A0F1")]
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
private PrivateKeyFactory()
{
}
// Token: 0x0600A0F2 RID: 41202 RVA: 0x002180E4 File Offset: 0x002162E4
[Token(Token = "0x600A0F2")]
[Address(RVA = "0x5E5B80", Offset = "0x5E4B80", VA = "0x1805E5B80")]
public static AsymmetricKeyParameter CreateKey(byte[] privateKeyInfoData)
{
return PrivateKeyFactory.CreateKey(PrivateKeyInfo.GetInstance(Asn1Object.FromByteArray(privateKeyInfoData)));
}
// Token: 0x0600A0F3 RID: 41203 RVA: 0x00218104 File Offset: 0x00216304
[Token(Token = "0x600A0F3")]
[Address(RVA = "0x5E5BB0", Offset = "0x5E4BB0", VA = "0x1805E5BB0")]
public static AsymmetricKeyParameter CreateKey(Stream inStr)
{
return PrivateKeyFactory.CreateKey(PrivateKeyInfo.GetInstance(Asn1Object.FromStream(inStr)));
}
// Token: 0x0600A0F4 RID: 41204 RVA: 0x00218124 File Offset: 0x00216324
[Token(Token = "0x600A0F4")]
[Address(RVA = "0x5E4C00", Offset = "0x5E3C00", VA = "0x1805E4C00")]
public static AsymmetricKeyParameter CreateKey(PrivateKeyInfo keyInfo)
{
/*
An exception occurred when decompiling this method (0600A0F4)
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.AsymmetricKeyParameter BestHTTP.SecureProtocol.Org.BouncyCastle.Security.PrivateKeyFactory::CreateKey(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs.PrivateKeyInfo)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_2D9:
stloc:ArgumentException(var_91_2E3, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Unrecognized curve OID for GostR3410x2001 private key")))
}
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: 0x0600A0F5 RID: 41205 RVA: 0x00218418 File Offset: 0x00216618
[Token(Token = "0x600A0F5")]
[Address(RVA = "0x5E5D40", Offset = "0x5E4D40", VA = "0x1805E5D40")]
private static byte[] GetRawKey(PrivateKeyInfo keyInfo, int expectedSize)
{
/*
An exception occurred when decompiling this method (0600A0F5)
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Security.PrivateKeyFactory::GetRawKey(BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs.PrivateKeyInfo,System.Int32)
---> System.Exception: Basic block has to end with unconditional control flow.
{
IL_1A:
stloc:SecurityUtilityException(var_1_24, newobj:SecurityUtilityException(SecurityUtilityException::.ctor, ldstr:string("private key encoding has incorrect length")))
}
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: 0x0600A0F6 RID: 41206 RVA: 0x0021844C File Offset: 0x0021664C
[Token(Token = "0x600A0F6")]
[Address(RVA = "0x5E5C60", Offset = "0x5E4C60", VA = "0x1805E5C60")]
public static AsymmetricKeyParameter DecryptKey(char[] passPhrase, EncryptedPrivateKeyInfo encInfo)
{
return PrivateKeyFactory.CreateKey(PrivateKeyInfoFactory.CreatePrivateKeyInfo(passPhrase, encInfo));
}
// Token: 0x0600A0F7 RID: 41207 RVA: 0x00218468 File Offset: 0x00216668
[Token(Token = "0x600A0F7")]
[Address(RVA = "0x5E5BE0", Offset = "0x5E4BE0", VA = "0x1805E5BE0")]
public static AsymmetricKeyParameter DecryptKey(char[] passPhrase, byte[] encryptedPrivateKeyInfoData)
{
EncryptedPrivateKeyInfo instance = EncryptedPrivateKeyInfo.GetInstance(Asn1Object.FromByteArray(encryptedPrivateKeyInfoData));
return PrivateKeyFactory.CreateKey(PrivateKeyInfoFactory.CreatePrivateKeyInfo(passPhrase, instance));
}
// Token: 0x0600A0F8 RID: 41208 RVA: 0x00218490 File Offset: 0x00216690
[Token(Token = "0x600A0F8")]
[Address(RVA = "0x5E5C80", Offset = "0x5E4C80", VA = "0x1805E5C80")]
public static AsymmetricKeyParameter DecryptKey(char[] passPhrase, Stream encryptedPrivateKeyInfoStream)
{
EncryptedPrivateKeyInfo instance = EncryptedPrivateKeyInfo.GetInstance(Asn1Object.FromStream(encryptedPrivateKeyInfoStream));
return PrivateKeyFactory.CreateKey(PrivateKeyInfoFactory.CreatePrivateKeyInfo(passPhrase, instance));
}
// Token: 0x0600A0F9 RID: 41209 RVA: 0x002184B8 File Offset: 0x002166B8
[Token(Token = "0x600A0F9")]
[Address(RVA = "0x5E5C20", Offset = "0x5E4C20", VA = "0x1805E5C20")]
private static AsymmetricKeyParameter DecryptKey(char[] passPhrase, Asn1Object asn1Object)
{
EncryptedPrivateKeyInfo instance = EncryptedPrivateKeyInfo.GetInstance(asn1Object);
return PrivateKeyFactory.CreateKey(PrivateKeyInfoFactory.CreatePrivateKeyInfo(passPhrase, instance));
}
// Token: 0x0600A0FA RID: 41210 RVA: 0x002184D8 File Offset: 0x002166D8
[Token(Token = "0x600A0FA")]
[Address(RVA = "0x5E5D00", Offset = "0x5E4D00", VA = "0x1805E5D00")]
public static byte[] EncryptKey(DerObjectIdentifier algorithm, char[] passPhrase, byte[] salt, int iterationCount, AsymmetricKeyParameter key)
{
EncryptedPrivateKeyInfo encryptedPrivateKeyInfo;
return encryptedPrivateKeyInfo.GetEncoded();
}
// Token: 0x0600A0FB RID: 41211 RVA: 0x002184F4 File Offset: 0x002166F4
[Token(Token = "0x600A0FB")]
[Address(RVA = "0x5E5CC0", Offset = "0x5E4CC0", VA = "0x1805E5CC0")]
public static byte[] EncryptKey(string algorithm, char[] passPhrase, byte[] salt, int iterationCount, AsymmetricKeyParameter key)
{
EncryptedPrivateKeyInfo encryptedPrivateKeyInfo;
return encryptedPrivateKeyInfo.GetEncoded();
}
}
}