226 lines
14 KiB
C#
226 lines
14 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Kisa;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Nist;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Ntt;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Pkcs;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Security
|
|
{
|
|
// Token: 0x020013DA RID: 5082
|
|
[Token(Token = "0x20013DA")]
|
|
[StructLayout(3)]
|
|
public sealed class WrapperUtilities
|
|
{
|
|
// Token: 0x06008183 RID: 33155 RVA: 0x001B8B6C File Offset: 0x001B6D6C
|
|
[Token(Token = "0x6008183")]
|
|
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
|
|
private WrapperUtilities()
|
|
{
|
|
}
|
|
|
|
// Token: 0x06008184 RID: 33156 RVA: 0x001B8B80 File Offset: 0x001B6D80
|
|
[Token(Token = "0x6008184")]
|
|
[Address(RVA = "0x1C70C80", Offset = "0x1C6F680", VA = "0x181C70C80")]
|
|
static WrapperUtilities()
|
|
{
|
|
IDictionary dictionary = Platform.CreateHashtable();
|
|
Enum arbitraryValue = Enums.GetArbitraryValue(typeof(WrapperUtilities.WrapAlgorithm));
|
|
DerObjectIdentifier idAes128Wrap = NistObjectIdentifiers.IdAes128Wrap;
|
|
DerObjectIdentifier idAes192Wrap = NistObjectIdentifiers.IdAes192Wrap;
|
|
DerObjectIdentifier idAes256Wrap = NistObjectIdentifiers.IdAes256Wrap;
|
|
DerObjectIdentifier idCamellia128Wrap = NttObjectIdentifiers.IdCamellia128Wrap;
|
|
DerObjectIdentifier idCamellia192Wrap = NttObjectIdentifiers.IdCamellia192Wrap;
|
|
DerObjectIdentifier idCamellia256Wrap = NttObjectIdentifiers.IdCamellia256Wrap;
|
|
DerObjectIdentifier idAlgCms3DesWrap = PkcsObjectIdentifiers.IdAlgCms3DesWrap;
|
|
DerObjectIdentifier idAlgCmsRC2Wrap = PkcsObjectIdentifiers.IdAlgCmsRC2Wrap;
|
|
DerObjectIdentifier idNpkiAppCmsSeedWrap = KisaObjectIdentifiers.IdNpkiAppCmsSeedWrap;
|
|
}
|
|
|
|
// Token: 0x06008185 RID: 33157 RVA: 0x001B8BF4 File Offset: 0x001B6DF4
|
|
[Token(Token = "0x6008185")]
|
|
[Address(RVA = "0x1C70C20", Offset = "0x1C6F620", VA = "0x181C70C20")]
|
|
public static IWrapper GetWrapper(DerObjectIdentifier oid)
|
|
{
|
|
return WrapperUtilities.GetWrapper(oid.identifier);
|
|
}
|
|
|
|
// Token: 0x06008186 RID: 33158 RVA: 0x001B8C14 File Offset: 0x001B6E14
|
|
[Token(Token = "0x6008186")]
|
|
[Address(RVA = "0x1C70880", Offset = "0x1C6F280", VA = "0x181C70880")]
|
|
public static IWrapper GetWrapper(string algorithm)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (06008186)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.IWrapper BestHTTP.SecureProtocol.Org.BouncyCastle.Security.WrapperUtilities::GetWrapper(System.String)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_94:
|
|
stloc:SecurityUtilityException(var_13_A9, newobj:SecurityUtilityException(SecurityUtilityException::.ctor, call:string(string::Concat, ldstr:string("Wrapper "), ldloc:string(algorithm), ldstr:string(" not recognised."))))
|
|
}
|
|
|
|
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: 0x06008187 RID: 33159 RVA: 0x001B8CCC File Offset: 0x001B6ECC
|
|
[Token(Token = "0x6008187")]
|
|
[Address(RVA = "0x1C707D0", Offset = "0x1C6F1D0", VA = "0x181C707D0")]
|
|
public static string GetAlgorithmName(DerObjectIdentifier oid)
|
|
{
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x04005BAD RID: 23469
|
|
[Token(Token = "0x4005BAD")]
|
|
private static readonly IDictionary algorithms;
|
|
|
|
// Token: 0x020013DB RID: 5083
|
|
[Token(Token = "0x20013DB")]
|
|
private enum WrapAlgorithm
|
|
{
|
|
// Token: 0x04005BAF RID: 23471
|
|
[Token(Token = "0x4005BAF")]
|
|
AESWRAP,
|
|
// Token: 0x04005BB0 RID: 23472
|
|
[Token(Token = "0x4005BB0")]
|
|
CAMELLIAWRAP,
|
|
// Token: 0x04005BB1 RID: 23473
|
|
[Token(Token = "0x4005BB1")]
|
|
DESEDEWRAP,
|
|
// Token: 0x04005BB2 RID: 23474
|
|
[Token(Token = "0x4005BB2")]
|
|
RC2WRAP,
|
|
// Token: 0x04005BB3 RID: 23475
|
|
[Token(Token = "0x4005BB3")]
|
|
SEEDWRAP,
|
|
// Token: 0x04005BB4 RID: 23476
|
|
[Token(Token = "0x4005BB4")]
|
|
DESEDERFC3211WRAP,
|
|
// Token: 0x04005BB5 RID: 23477
|
|
[Token(Token = "0x4005BB5")]
|
|
AESRFC3211WRAP,
|
|
// Token: 0x04005BB6 RID: 23478
|
|
[Token(Token = "0x4005BB6")]
|
|
CAMELLIARFC3211WRAP
|
|
}
|
|
|
|
// Token: 0x020013DC RID: 5084
|
|
[Token(Token = "0x20013DC")]
|
|
private class BufferedCipherWrapper : IWrapper
|
|
{
|
|
// Token: 0x06008188 RID: 33160 RVA: 0x001B8CE0 File Offset: 0x001B6EE0
|
|
[Token(Token = "0x6008188")]
|
|
[Address(RVA = "0x3C3A30", Offset = "0x3C2430", VA = "0x1803C3A30")]
|
|
public BufferedCipherWrapper(IBufferedCipher cipher)
|
|
{
|
|
this.cipher = cipher;
|
|
}
|
|
|
|
// Token: 0x17001508 RID: 5384
|
|
// (get) Token: 0x06008189 RID: 33161 RVA: 0x001B8CFC File Offset: 0x001B6EFC
|
|
[Token(Token = "0x17001508")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x6008189")]
|
|
[Address(RVA = "0x1C5DDD0", Offset = "0x1C5C7D0", VA = "0x181C5DDD0", Slot = "4")]
|
|
get
|
|
{
|
|
IBufferedCipher bufferedCipher = this.cipher;
|
|
int num = 0;
|
|
num += num;
|
|
num++;
|
|
return bufferedCipher.AlgorithmName;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600818A RID: 33162 RVA: 0x001B8D30 File Offset: 0x001B6F30
|
|
[Token(Token = "0x600818A")]
|
|
[Address(RVA = "0x1C5DBE0", Offset = "0x1C5C5E0", VA = "0x181C5DBE0", Slot = "5")]
|
|
public void Init(bool forWrapping, ICipherParameters parameters)
|
|
{
|
|
IBufferedCipher bufferedCipher = this.cipher;
|
|
this.forWrapping = forWrapping;
|
|
}
|
|
|
|
// Token: 0x0600818B RID: 33163 RVA: 0x001B8D54 File Offset: 0x001B6F54
|
|
[Token(Token = "0x600818B")]
|
|
[Address(RVA = "0x1C5DD10", Offset = "0x1C5C710", VA = "0x181C5DD10", Slot = "6")]
|
|
public byte[] Wrap(byte[] input, int inOff, int length)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600818B)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Security.WrapperUtilities/BufferedCipherWrapper::Wrap(System.Byte[],System.Int32,System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_10:
|
|
stloc:InvalidOperationException(var_1_1A, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Not initialised for wrapping")))
|
|
}
|
|
|
|
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: 0x0600818C RID: 33164 RVA: 0x001B8D7C File Offset: 0x001B6F7C
|
|
[Token(Token = "0x600818C")]
|
|
[Address(RVA = "0x1C5DC50", Offset = "0x1C5C650", VA = "0x181C5DC50", Slot = "7")]
|
|
public byte[] Unwrap(byte[] input, int inOff, int length)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600818C)
|
|
|
|
ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Byte[] BestHTTP.SecureProtocol.Org.BouncyCastle.Security.WrapperUtilities/BufferedCipherWrapper::Unwrap(System.Byte[],System.Int32,System.Int32)
|
|
|
|
---> System.Exception: Basic block has to end with unconditional control flow.
|
|
{
|
|
IL_10:
|
|
stloc:InvalidOperationException(var_1_1A, newobj:InvalidOperationException(InvalidOperationException::.ctor, ldstr:string("Not initialised for unwrapping")))
|
|
}
|
|
|
|
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: 0x04005BB7 RID: 23479
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4005BB7")]
|
|
private readonly IBufferedCipher cipher;
|
|
|
|
// Token: 0x04005BB8 RID: 23480
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4005BB8")]
|
|
private bool forWrapping;
|
|
}
|
|
}
|
|
}
|