Files
Aug2021-Cpp2IL-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Security/WrapperUtilities.cs
T
2026-04-10 22:50:51 +02:00

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: 0x020019B7 RID: 6583
[Token(Token = "0x20019B7")]
public sealed class WrapperUtilities
{
// Token: 0x06009D5D RID: 40285 RVA: 0x00210118 File Offset: 0x0020E318
[Token(Token = "0x6009D5D")]
[Address(RVA = "0x3F5100", Offset = "0x3F3F00", VA = "0x1803F5100")]
private WrapperUtilities()
{
}
// Token: 0x06009D5E RID: 40286 RVA: 0x0021012C File Offset: 0x0020E32C
[Token(Token = "0x6009D5E")]
[Address(RVA = "0x1B2E130", Offset = "0x1B2CF30", VA = "0x181B2E130")]
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: 0x06009D5F RID: 40287 RVA: 0x002101A0 File Offset: 0x0020E3A0
[Token(Token = "0x6009D5F")]
[Address(RVA = "0x1B2E0D0", Offset = "0x1B2CED0", VA = "0x181B2E0D0")]
public static IWrapper GetWrapper(DerObjectIdentifier oid)
{
return WrapperUtilities.GetWrapper(oid.identifier);
}
// Token: 0x06009D60 RID: 40288 RVA: 0x002101C0 File Offset: 0x0020E3C0
[Token(Token = "0x6009D60")]
[Address(RVA = "0x1B2DD30", Offset = "0x1B2CB30", VA = "0x181B2DD30")]
public static IWrapper GetWrapper(string algorithm)
{
/*
An exception occurred when decompiling this method (06009D60)
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: 0x06009D61 RID: 40289 RVA: 0x00210278 File Offset: 0x0020E478
[Token(Token = "0x6009D61")]
[Address(RVA = "0x1B2DC80", Offset = "0x1B2CA80", VA = "0x181B2DC80")]
public static string GetAlgorithmName(DerObjectIdentifier oid)
{
throw new NullReferenceException();
}
// Token: 0x040069F0 RID: 27120
[Token(Token = "0x40069F0")]
private static readonly IDictionary algorithms;
// Token: 0x020019B8 RID: 6584
[Token(Token = "0x20019B8")]
private enum WrapAlgorithm
{
// Token: 0x040069F2 RID: 27122
[Token(Token = "0x40069F2")]
AESWRAP,
// Token: 0x040069F3 RID: 27123
[Token(Token = "0x40069F3")]
CAMELLIAWRAP,
// Token: 0x040069F4 RID: 27124
[Token(Token = "0x40069F4")]
DESEDEWRAP,
// Token: 0x040069F5 RID: 27125
[Token(Token = "0x40069F5")]
RC2WRAP,
// Token: 0x040069F6 RID: 27126
[Token(Token = "0x40069F6")]
SEEDWRAP,
// Token: 0x040069F7 RID: 27127
[Token(Token = "0x40069F7")]
DESEDERFC3211WRAP,
// Token: 0x040069F8 RID: 27128
[Token(Token = "0x40069F8")]
AESRFC3211WRAP,
// Token: 0x040069F9 RID: 27129
[Token(Token = "0x40069F9")]
CAMELLIARFC3211WRAP
}
// Token: 0x020019B9 RID: 6585
[Token(Token = "0x20019B9")]
private class BufferedCipherWrapper : IWrapper
{
// Token: 0x06009D62 RID: 40290 RVA: 0x0021028C File Offset: 0x0020E48C
[Token(Token = "0x6009D62")]
[Address(RVA = "0x3FFB80", Offset = "0x3FE980", VA = "0x1803FFB80")]
public BufferedCipherWrapper(IBufferedCipher cipher)
{
this.cipher = cipher;
}
// Token: 0x17001909 RID: 6409
// (get) Token: 0x06009D63 RID: 40291 RVA: 0x002102A8 File Offset: 0x0020E4A8
[Token(Token = "0x17001909")]
public string AlgorithmName
{
[Token(Token = "0x6009D63")]
[Address(RVA = "0x1B14F30", Offset = "0x1B13D30", VA = "0x181B14F30", Slot = "4")]
get
{
IBufferedCipher bufferedCipher = this.cipher;
int num = 0;
num += num;
num++;
return bufferedCipher.AlgorithmName;
}
}
// Token: 0x06009D64 RID: 40292 RVA: 0x002102DC File Offset: 0x0020E4DC
[Token(Token = "0x6009D64")]
[Address(RVA = "0x1B14D40", Offset = "0x1B13B40", VA = "0x181B14D40", Slot = "5")]
public void Init(bool forWrapping, ICipherParameters parameters)
{
IBufferedCipher bufferedCipher = this.cipher;
this.forWrapping = forWrapping;
}
// Token: 0x06009D65 RID: 40293 RVA: 0x00210300 File Offset: 0x0020E500
[Token(Token = "0x6009D65")]
[Address(RVA = "0x1B14E70", Offset = "0x1B13C70", VA = "0x181B14E70", Slot = "6")]
public byte[] Wrap(byte[] input, int inOff, int length)
{
/*
An exception occurred when decompiling this method (06009D65)
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: 0x06009D66 RID: 40294 RVA: 0x00210328 File Offset: 0x0020E528
[Token(Token = "0x6009D66")]
[Address(RVA = "0x1B14DB0", Offset = "0x1B13BB0", VA = "0x181B14DB0", Slot = "7")]
public byte[] Unwrap(byte[] input, int inOff, int length)
{
/*
An exception occurred when decompiling this method (06009D66)
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: 0x040069FA RID: 27130
[FieldOffset(Offset = "0x10")]
[Token(Token = "0x40069FA")]
private readonly IBufferedCipher cipher;
// Token: 0x040069FB RID: 27131
[FieldOffset(Offset = "0x18")]
[Token(Token = "0x40069FB")]
private bool forWrapping;
}
}
}