a
This commit is contained in:
@@ -0,0 +1,144 @@
|
||||
using System;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Generators;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl
|
||||
{
|
||||
// Token: 0x02001999 RID: 6553
|
||||
[Token(Token = "0x2001999")]
|
||||
internal sealed class PemUtilities
|
||||
{
|
||||
// Token: 0x06009C8C RID: 40076 RVA: 0x0020A5CC File Offset: 0x002087CC
|
||||
[Token(Token = "0x6009C8C")]
|
||||
[Address(RVA = "0x1CBD350", Offset = "0x1CBC150", VA = "0x181CBD350")]
|
||||
static PemUtilities()
|
||||
{
|
||||
Enum arbitraryValue = Enums.GetArbitraryValue(typeof(PemUtilities.PemBaseAlg));
|
||||
Enum arbitraryValue2 = Enums.GetArbitraryValue(typeof(PemUtilities.PemMode));
|
||||
}
|
||||
|
||||
// Token: 0x06009C8D RID: 40077 RVA: 0x0020A614 File Offset: 0x00208814
|
||||
[Token(Token = "0x6009C8D")]
|
||||
[Address(RVA = "0x1CBD0D0", Offset = "0x1CBBED0", VA = "0x181CBD0D0")]
|
||||
private static void ParseDekAlgName(string dekAlgName, out PemUtilities.PemBaseAlg baseAlg, out PemUtilities.PemMode mode)
|
||||
{
|
||||
Type typeFromHandle = typeof(PemUtilities.PemBaseAlg);
|
||||
int num = 0;
|
||||
int num2;
|
||||
string text = dekAlgName.Substring(num, num2);
|
||||
Enum enumValue = Enums.GetEnumValue(typeFromHandle, text);
|
||||
baseAlg.value__ = enumValue;
|
||||
Type typeFromHandle2 = typeof(PemUtilities.PemMode);
|
||||
int num3 = num2 + 1;
|
||||
string text2 = dekAlgName.Substring(num3);
|
||||
Enum enumValue2 = Enums.GetEnumValue(typeFromHandle2, text2);
|
||||
mode.value__ = enumValue2;
|
||||
Enum enumValue3 = Enums.GetEnumValue(typeof(PemUtilities.PemBaseAlg), dekAlgName);
|
||||
baseAlg.value__ = enumValue3;
|
||||
}
|
||||
|
||||
// Token: 0x06009C8E RID: 40078 RVA: 0x0020A6BC File Offset: 0x002088BC
|
||||
[Token(Token = "0x6009C8E")]
|
||||
[Address(RVA = "0x1CBC930", Offset = "0x1CBB730", VA = "0x181CBC930")]
|
||||
internal static byte[] Crypt(bool encrypt, byte[] bytes, char[] password, string dekAlgName, byte[] iv)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (06009C8E)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.OpenSsl.PemUtilities::Crypt(System.Boolean,System.Byte[],System.Char[],System.String,System.Byte[])
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_B6:
|
||||
stloc:EncryptionException(var_15_C7, newobj:EncryptionException(EncryptionException::.ctor, call:string(string::Concat, ldstr:string("Unknown DEK algorithm: "), ldloc:string(var_13))))
|
||||
}
|
||||
|
||||
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: 0x06009C8F RID: 40079 RVA: 0x0020A794 File Offset: 0x00208994
|
||||
[Token(Token = "0x6009C8F")]
|
||||
[Address(RVA = "0x1CBCF40", Offset = "0x1CBBD40", VA = "0x181CBCF40")]
|
||||
private static ICipherParameters GetCipherParameters(char[] password, PemUtilities.PemBaseAlg baseAlg, byte[] salt)
|
||||
{
|
||||
if (baseAlg <= PemUtilities.PemBaseAlg.RC2_64)
|
||||
{
|
||||
OpenSslPbeParametersGenerator openSslPbeParametersGenerator = new OpenSslPbeParametersGenerator();
|
||||
byte[] array = PbeParametersGenerator.Pkcs5PasswordToBytes(password);
|
||||
ICipherParameters cipherParameters;
|
||||
return cipherParameters;
|
||||
}
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x06009C90 RID: 40080 RVA: 0x0020A7BC File Offset: 0x002089BC
|
||||
[Token(Token = "0x6009C90")]
|
||||
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
|
||||
public PemUtilities()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0200199A RID: 6554
|
||||
[Token(Token = "0x200199A")]
|
||||
private enum PemBaseAlg
|
||||
{
|
||||
// Token: 0x0400693D RID: 26941
|
||||
[Token(Token = "0x400693D")]
|
||||
AES_128,
|
||||
// Token: 0x0400693E RID: 26942
|
||||
[Token(Token = "0x400693E")]
|
||||
AES_192,
|
||||
// Token: 0x0400693F RID: 26943
|
||||
[Token(Token = "0x400693F")]
|
||||
AES_256,
|
||||
// Token: 0x04006940 RID: 26944
|
||||
[Token(Token = "0x4006940")]
|
||||
BF,
|
||||
// Token: 0x04006941 RID: 26945
|
||||
[Token(Token = "0x4006941")]
|
||||
DES,
|
||||
// Token: 0x04006942 RID: 26946
|
||||
[Token(Token = "0x4006942")]
|
||||
DES_EDE,
|
||||
// Token: 0x04006943 RID: 26947
|
||||
[Token(Token = "0x4006943")]
|
||||
DES_EDE3,
|
||||
// Token: 0x04006944 RID: 26948
|
||||
[Token(Token = "0x4006944")]
|
||||
RC2,
|
||||
// Token: 0x04006945 RID: 26949
|
||||
[Token(Token = "0x4006945")]
|
||||
RC2_40,
|
||||
// Token: 0x04006946 RID: 26950
|
||||
[Token(Token = "0x4006946")]
|
||||
RC2_64
|
||||
}
|
||||
|
||||
// Token: 0x0200199B RID: 6555
|
||||
[Token(Token = "0x200199B")]
|
||||
private enum PemMode
|
||||
{
|
||||
// Token: 0x04006948 RID: 26952
|
||||
[Token(Token = "0x4006948")]
|
||||
CBC,
|
||||
// Token: 0x04006949 RID: 26953
|
||||
[Token(Token = "0x4006949")]
|
||||
CFB,
|
||||
// Token: 0x0400694A RID: 26954
|
||||
[Token(Token = "0x400694A")]
|
||||
ECB,
|
||||
// Token: 0x0400694B RID: 26955
|
||||
[Token(Token = "0x400694B")]
|
||||
OFB
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user