scripts
This commit is contained in:
@@ -0,0 +1,146 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
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: 0x020013BC RID: 5052
|
||||
[Token(Token = "0x20013BC")]
|
||||
[StructLayout(3)]
|
||||
internal sealed class PemUtilities
|
||||
{
|
||||
// Token: 0x060080B2 RID: 32946 RVA: 0x001B3358 File Offset: 0x001B1558
|
||||
[Token(Token = "0x60080B2")]
|
||||
[Address(RVA = "0x4DDDA0", Offset = "0x4DC7A0", VA = "0x1804DDDA0")]
|
||||
static PemUtilities()
|
||||
{
|
||||
Enum arbitraryValue = Enums.GetArbitraryValue(typeof(PemUtilities.PemBaseAlg));
|
||||
Enum arbitraryValue2 = Enums.GetArbitraryValue(typeof(PemUtilities.PemMode));
|
||||
}
|
||||
|
||||
// Token: 0x060080B3 RID: 32947 RVA: 0x001B33A0 File Offset: 0x001B15A0
|
||||
[Token(Token = "0x60080B3")]
|
||||
[Address(RVA = "0x4DDB20", Offset = "0x4DC520", VA = "0x1804DDB20")]
|
||||
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: 0x060080B4 RID: 32948 RVA: 0x001B3448 File Offset: 0x001B1648
|
||||
[Token(Token = "0x60080B4")]
|
||||
[Address(RVA = "0x4DD380", Offset = "0x4DBD80", VA = "0x1804DD380")]
|
||||
internal static byte[] Crypt(bool encrypt, byte[] bytes, char[] password, string dekAlgName, byte[] iv)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (060080B4)
|
||||
|
||||
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 1663
|
||||
*/;
|
||||
}
|
||||
|
||||
// Token: 0x060080B5 RID: 32949 RVA: 0x001B3520 File Offset: 0x001B1720
|
||||
[Token(Token = "0x60080B5")]
|
||||
[Address(RVA = "0x4DD990", Offset = "0x4DC390", VA = "0x1804DD990")]
|
||||
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: 0x060080B6 RID: 32950 RVA: 0x001B3548 File Offset: 0x001B1748
|
||||
[Token(Token = "0x60080B6")]
|
||||
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
||||
public PemUtilities()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x020013BD RID: 5053
|
||||
[Token(Token = "0x20013BD")]
|
||||
private enum PemBaseAlg
|
||||
{
|
||||
// Token: 0x04005AFA RID: 23290
|
||||
[Token(Token = "0x4005AFA")]
|
||||
AES_128,
|
||||
// Token: 0x04005AFB RID: 23291
|
||||
[Token(Token = "0x4005AFB")]
|
||||
AES_192,
|
||||
// Token: 0x04005AFC RID: 23292
|
||||
[Token(Token = "0x4005AFC")]
|
||||
AES_256,
|
||||
// Token: 0x04005AFD RID: 23293
|
||||
[Token(Token = "0x4005AFD")]
|
||||
BF,
|
||||
// Token: 0x04005AFE RID: 23294
|
||||
[Token(Token = "0x4005AFE")]
|
||||
DES,
|
||||
// Token: 0x04005AFF RID: 23295
|
||||
[Token(Token = "0x4005AFF")]
|
||||
DES_EDE,
|
||||
// Token: 0x04005B00 RID: 23296
|
||||
[Token(Token = "0x4005B00")]
|
||||
DES_EDE3,
|
||||
// Token: 0x04005B01 RID: 23297
|
||||
[Token(Token = "0x4005B01")]
|
||||
RC2,
|
||||
// Token: 0x04005B02 RID: 23298
|
||||
[Token(Token = "0x4005B02")]
|
||||
RC2_40,
|
||||
// Token: 0x04005B03 RID: 23299
|
||||
[Token(Token = "0x4005B03")]
|
||||
RC2_64
|
||||
}
|
||||
|
||||
// Token: 0x020013BE RID: 5054
|
||||
[Token(Token = "0x20013BE")]
|
||||
private enum PemMode
|
||||
{
|
||||
// Token: 0x04005B05 RID: 23301
|
||||
[Token(Token = "0x4005B05")]
|
||||
CBC,
|
||||
// Token: 0x04005B06 RID: 23302
|
||||
[Token(Token = "0x4005B06")]
|
||||
CFB,
|
||||
// Token: 0x04005B07 RID: 23303
|
||||
[Token(Token = "0x4005B07")]
|
||||
ECB,
|
||||
// Token: 0x04005B08 RID: 23304
|
||||
[Token(Token = "0x4005B08")]
|
||||
OFB
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user