224 lines
14 KiB
C#
224 lines
14 KiB
C#
using System;
|
|
using System.Collections;
|
|
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: 0x02001A97 RID: 6807
|
|
[Token(Token = "0x2001A97")]
|
|
public sealed class WrapperUtilities
|
|
{
|
|
// Token: 0x0600A12B RID: 41259 RVA: 0x002191B4 File Offset: 0x002173B4
|
|
[Token(Token = "0x600A12B")]
|
|
[Address(RVA = "0x412370", Offset = "0x411370", VA = "0x180412370")]
|
|
private WrapperUtilities()
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600A12C RID: 41260 RVA: 0x002191C8 File Offset: 0x002173C8
|
|
[Token(Token = "0x600A12C")]
|
|
[Address(RVA = "0x5F3C70", Offset = "0x5F2C70", VA = "0x1805F3C70")]
|
|
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: 0x0600A12D RID: 41261 RVA: 0x0021923C File Offset: 0x0021743C
|
|
[Token(Token = "0x600A12D")]
|
|
[Address(RVA = "0x5F3C10", Offset = "0x5F2C10", VA = "0x1805F3C10")]
|
|
public static IWrapper GetWrapper(DerObjectIdentifier oid)
|
|
{
|
|
return WrapperUtilities.GetWrapper(oid.identifier);
|
|
}
|
|
|
|
// Token: 0x0600A12E RID: 41262 RVA: 0x0021925C File Offset: 0x0021745C
|
|
[Token(Token = "0x600A12E")]
|
|
[Address(RVA = "0x5F3870", Offset = "0x5F2870", VA = "0x1805F3870")]
|
|
public static IWrapper GetWrapper(string algorithm)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600A12E)
|
|
|
|
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: 0x0600A12F RID: 41263 RVA: 0x00219314 File Offset: 0x00217514
|
|
[Token(Token = "0x600A12F")]
|
|
[Address(RVA = "0x5F37C0", Offset = "0x5F27C0", VA = "0x1805F37C0")]
|
|
public static string GetAlgorithmName(DerObjectIdentifier oid)
|
|
{
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x04006BA9 RID: 27561
|
|
[Token(Token = "0x4006BA9")]
|
|
private static readonly IDictionary algorithms;
|
|
|
|
// Token: 0x02001A98 RID: 6808
|
|
[Token(Token = "0x2001A98")]
|
|
private enum WrapAlgorithm
|
|
{
|
|
// Token: 0x04006BAB RID: 27563
|
|
[Token(Token = "0x4006BAB")]
|
|
AESWRAP,
|
|
// Token: 0x04006BAC RID: 27564
|
|
[Token(Token = "0x4006BAC")]
|
|
CAMELLIAWRAP,
|
|
// Token: 0x04006BAD RID: 27565
|
|
[Token(Token = "0x4006BAD")]
|
|
DESEDEWRAP,
|
|
// Token: 0x04006BAE RID: 27566
|
|
[Token(Token = "0x4006BAE")]
|
|
RC2WRAP,
|
|
// Token: 0x04006BAF RID: 27567
|
|
[Token(Token = "0x4006BAF")]
|
|
SEEDWRAP,
|
|
// Token: 0x04006BB0 RID: 27568
|
|
[Token(Token = "0x4006BB0")]
|
|
DESEDERFC3211WRAP,
|
|
// Token: 0x04006BB1 RID: 27569
|
|
[Token(Token = "0x4006BB1")]
|
|
AESRFC3211WRAP,
|
|
// Token: 0x04006BB2 RID: 27570
|
|
[Token(Token = "0x4006BB2")]
|
|
CAMELLIARFC3211WRAP
|
|
}
|
|
|
|
// Token: 0x02001A99 RID: 6809
|
|
[Token(Token = "0x2001A99")]
|
|
private class BufferedCipherWrapper : IWrapper
|
|
{
|
|
// Token: 0x0600A130 RID: 41264 RVA: 0x00219328 File Offset: 0x00217528
|
|
[Token(Token = "0x600A130")]
|
|
[Address(RVA = "0x493D90", Offset = "0x492D90", VA = "0x180493D90")]
|
|
public BufferedCipherWrapper(IBufferedCipher cipher)
|
|
{
|
|
this.cipher = cipher;
|
|
}
|
|
|
|
// Token: 0x170019A6 RID: 6566
|
|
// (get) Token: 0x0600A131 RID: 41265 RVA: 0x00219344 File Offset: 0x00217544
|
|
[Token(Token = "0x170019A6")]
|
|
public string AlgorithmName
|
|
{
|
|
[Token(Token = "0x600A131")]
|
|
[Address(RVA = "0x5DA9A0", Offset = "0x5D99A0", VA = "0x1805DA9A0", Slot = "4")]
|
|
get
|
|
{
|
|
IBufferedCipher bufferedCipher = this.cipher;
|
|
int num = 0;
|
|
num += num;
|
|
num++;
|
|
return bufferedCipher.AlgorithmName;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0600A132 RID: 41266 RVA: 0x00219378 File Offset: 0x00217578
|
|
[Token(Token = "0x600A132")]
|
|
[Address(RVA = "0x5DA7B0", Offset = "0x5D97B0", VA = "0x1805DA7B0", Slot = "5")]
|
|
public void Init(bool forWrapping, ICipherParameters parameters)
|
|
{
|
|
IBufferedCipher bufferedCipher = this.cipher;
|
|
this.forWrapping = forWrapping;
|
|
}
|
|
|
|
// Token: 0x0600A133 RID: 41267 RVA: 0x0021939C File Offset: 0x0021759C
|
|
[Token(Token = "0x600A133")]
|
|
[Address(RVA = "0x5DA8E0", Offset = "0x5D98E0", VA = "0x1805DA8E0", Slot = "6")]
|
|
public byte[] Wrap(byte[] input, int inOff, int length)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600A133)
|
|
|
|
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: 0x0600A134 RID: 41268 RVA: 0x002193C4 File Offset: 0x002175C4
|
|
[Token(Token = "0x600A134")]
|
|
[Address(RVA = "0x5DA820", Offset = "0x5D9820", VA = "0x1805DA820", Slot = "7")]
|
|
public byte[] Unwrap(byte[] input, int inOff, int length)
|
|
{
|
|
/*
|
|
An exception occurred when decompiling this method (0600A134)
|
|
|
|
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: 0x04006BB3 RID: 27571
|
|
[FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x4006BB3")]
|
|
private readonly IBufferedCipher cipher;
|
|
|
|
// Token: 0x04006BB4 RID: 27572
|
|
[FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x4006BB4")]
|
|
private bool forWrapping;
|
|
}
|
|
}
|
|
}
|