scripts
This commit is contained in:
+261
@@ -0,0 +1,261 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.Cms.Ecc;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Asn1.X509;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Pkcs;
|
||||
using BestHTTP.SecureProtocol.Org.BouncyCastle.Security;
|
||||
using Cpp2IlInjected;
|
||||
|
||||
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Cms
|
||||
{
|
||||
// Token: 0x0200177D RID: 6013
|
||||
[Token(Token = "0x200177D")]
|
||||
[StructLayout(3)]
|
||||
public class KeyAgreeRecipientInformation : RecipientInformation
|
||||
{
|
||||
// Token: 0x0600A27C RID: 41596 RVA: 0x0025D778 File Offset: 0x0025B978
|
||||
[Token(Token = "0x600A27C")]
|
||||
[Address(RVA = "0x660160", Offset = "0x65EB60", VA = "0x180660160")]
|
||||
internal static void ReadRecipientInfo(IList infos, KeyAgreeRecipientInfo info, CmsSecureReadable secureReadable)
|
||||
{
|
||||
int num = 0;
|
||||
IEnumerator enumerator = info.recipientEncryptedKeys.GetEnumerator();
|
||||
if (enumerator != 0)
|
||||
{
|
||||
if (num < enumerator)
|
||||
{
|
||||
num += num;
|
||||
num++;
|
||||
}
|
||||
ulong num2;
|
||||
enumerator += num2;
|
||||
if (enumerator == 0 || enumerator == 0)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
RecipientID recipientID = new RecipientID();
|
||||
RecipientEncryptedKey recipientEncryptedKey;
|
||||
KeyAgreeRecipientIdentifier identifier = recipientEncryptedKey.identifier;
|
||||
if (identifier.issuerSerial == 0)
|
||||
{
|
||||
Stream octetStream = identifier.rKeyID.subjectKeyIdentifier.GetOctetStream();
|
||||
}
|
||||
byte[] authorityKeyIdentifier = recipientID.authorityKeyIdentifier;
|
||||
recipientID.issuer = authorityKeyIdentifier;
|
||||
int basicConstraints = recipientID.basicConstraints;
|
||||
BigInteger bigInteger;
|
||||
recipientID.serialNumber = bigInteger;
|
||||
}
|
||||
KeyAgreeRecipientInformation keyAgreeRecipientInformation;
|
||||
if (keyAgreeRecipientInformation != 0)
|
||||
{
|
||||
}
|
||||
if (num != -1)
|
||||
{
|
||||
}
|
||||
if (num == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600A27D RID: 41597 RVA: 0x0025D860 File Offset: 0x0025BA60
|
||||
[Token(Token = "0x600A27D")]
|
||||
[Address(RVA = "0x660680", Offset = "0x65F080", VA = "0x180660680")]
|
||||
internal KeyAgreeRecipientInformation(KeyAgreeRecipientInfo info, RecipientID rid, Asn1OctetString encryptedKey, CmsSecureReadable secureReadable)
|
||||
{
|
||||
this.rid = rid;
|
||||
this.encryptedKey = encryptedKey;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
// Token: 0x0600A27E RID: 41598 RVA: 0x0025D888 File Offset: 0x0025BA88
|
||||
[Token(Token = "0x600A27E")]
|
||||
[Address(RVA = "0x65FC00", Offset = "0x65E600", VA = "0x18065FC00")]
|
||||
private AsymmetricKeyParameter GetSenderPublicKey(AsymmetricKeyParameter receiverPrivateKey, OriginatorIdentifierOrKey originator)
|
||||
{
|
||||
OriginatorPublicKey originatorPublicKey = originator.OriginatorPublicKey;
|
||||
if (originatorPublicKey != 0)
|
||||
{
|
||||
return this.GetPublicKeyFromOriginatorPublicKey(receiverPrivateKey, originatorPublicKey);
|
||||
}
|
||||
OriginatorID originatorID = new OriginatorID();
|
||||
IssuerAndSerialNumber issuerAndSerialNumber = originator.IssuerAndSerialNumber;
|
||||
if (issuerAndSerialNumber == 0)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600A27F RID: 41599 RVA: 0x0025D938 File Offset: 0x0025BB38
|
||||
[Token(Token = "0x600A27F")]
|
||||
[Address(RVA = "0x65FB40", Offset = "0x65E540", VA = "0x18065FB40")]
|
||||
private AsymmetricKeyParameter GetPublicKeyFromOriginatorPublicKey(AsymmetricKeyParameter receiverPrivateKey, OriginatorPublicKey originatorPublicKey)
|
||||
{
|
||||
bool hasPublicKey = PrivateKeyInfoFactory.CreatePrivateKeyInfo(receiverPrivateKey).HasPublicKey;
|
||||
byte[] octets = originatorPublicKey.mPublicKey.GetOctets();
|
||||
SubjectPublicKeyInfo subjectPublicKeyInfo;
|
||||
return PublicKeyFactory.CreateKey(subjectPublicKeyInfo);
|
||||
}
|
||||
|
||||
// Token: 0x0600A280 RID: 41600 RVA: 0x0025D96C File Offset: 0x0025BB6C
|
||||
[Token(Token = "0x600A280")]
|
||||
[Address(RVA = "0x65FAE0", Offset = "0x65E4E0", VA = "0x18065FAE0")]
|
||||
private AsymmetricKeyParameter GetPublicKeyFromOriginatorID(OriginatorID origID)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600A280)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.AsymmetricKeyParameter BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.KeyAgreeRecipientInformation::GetPublicKeyFromOriginatorID(BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.OriginatorID)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
Block_0:
|
||||
stloc:CmsException(var_0_0A, newobj:CmsException(CmsException::.ctor, ldstr:string("No support for 'originator' as IssuerAndSerialNumber or SubjectKeyIdentifier")))
|
||||
}
|
||||
|
||||
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: 0x0600A281 RID: 41601 RVA: 0x0025D984 File Offset: 0x0025BB84
|
||||
[Token(Token = "0x600A281")]
|
||||
[Address(RVA = "0x65F600", Offset = "0x65E000", VA = "0x18065F600")]
|
||||
private KeyParameter CalculateAgreedWrapKey(string wrapAlg, AsymmetricKeyParameter senderPublicKey, AsymmetricKeyParameter receiverPrivateKey)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
Asn1Object asn1Object = this.keyEncAlg.ToAsn1Object();
|
||||
string ecmqvSha1Kdf = CmsEnvelopedGenerator.ECMqvSha1Kdf;
|
||||
bool flag;
|
||||
if (!flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
Stream octetStream = this.info.ukm.GetOctetStream();
|
||||
Asn1Object asn1Object2;
|
||||
OriginatorPublicKey ephemeralPublicKey = MQVuserKeyingMaterial.GetInstance(asn1Object2).ephemeralPublicKey;
|
||||
AsymmetricKeyParameter publicKeyFromOriginatorPublicKey = this.GetPublicKeyFromOriginatorPublicKey(receiverPrivateKey, ephemeralPublicKey);
|
||||
if (publicKeyFromOriginatorPublicKey == 0)
|
||||
{
|
||||
}
|
||||
if (publicKeyFromOriginatorPublicKey != 0)
|
||||
{
|
||||
if (senderPublicKey == 0)
|
||||
{
|
||||
}
|
||||
if (senderPublicKey != 0)
|
||||
{
|
||||
if (receiverPrivateKey == 0)
|
||||
{
|
||||
}
|
||||
if (receiverPrivateKey != 0 && receiverPrivateKey != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int num = 0;
|
||||
int defaultKeySize = GeneratorUtilities.GetDefaultKeySize(wrapAlg);
|
||||
num += defaultKeySize;
|
||||
byte[] array;
|
||||
return ParameterUtilities.CreateKeyParameter(wrapAlg, array);
|
||||
}
|
||||
|
||||
// Token: 0x0600A282 RID: 41602 RVA: 0x0025DA1C File Offset: 0x0025BC1C
|
||||
[Token(Token = "0x600A282")]
|
||||
[Address(RVA = "0x660550", Offset = "0x65EF50", VA = "0x180660550")]
|
||||
private KeyParameter UnwrapSessionKey(string wrapAlg, KeyParameter agreedKey)
|
||||
{
|
||||
Stream octetStream = this.encryptedKey.GetOctetStream();
|
||||
IWrapper wrapper = WrapperUtilities.GetWrapper(wrapAlg);
|
||||
Stream.ReadWriteTask activeReadWriteTask = octetStream._activeReadWriteTask;
|
||||
string contentAlgorithmName = base.GetContentAlgorithmName();
|
||||
KeyParameter keyParameter;
|
||||
return keyParameter;
|
||||
}
|
||||
|
||||
// Token: 0x0600A283 RID: 41603 RVA: 0x0025DA54 File Offset: 0x0025BC54
|
||||
[Token(Token = "0x600A283")]
|
||||
[Address(RVA = "0x65FD60", Offset = "0x65E760", VA = "0x18065FD60")]
|
||||
internal KeyParameter GetSessionKey(AsymmetricKeyParameter receiverPrivateKey)
|
||||
{
|
||||
Asn1SequenceParser parser = Asn1Sequence.GetInstance(this.keyEncAlg.ObjectID).Parser;
|
||||
DerObjectIdentifier derObjectIdentifier;
|
||||
string identifier = derObjectIdentifier.identifier;
|
||||
OriginatorIdentifierOrKey originator = this.info.originator;
|
||||
OriginatorPublicKey originatorPublicKey = originator.OriginatorPublicKey;
|
||||
if (originatorPublicKey != 0)
|
||||
{
|
||||
AsymmetricKeyParameter publicKeyFromOriginatorPublicKey = this.GetPublicKeyFromOriginatorPublicKey(receiverPrivateKey, originatorPublicKey);
|
||||
KeyParameter keyParameter = this.CalculateAgreedWrapKey(identifier, publicKeyFromOriginatorPublicKey, receiverPrivateKey);
|
||||
Stream octetStream = this.encryptedKey.GetOctetStream();
|
||||
IWrapper wrapper = WrapperUtilities.GetWrapper(identifier);
|
||||
Stream.ReadWriteTask activeReadWriteTask = octetStream._activeReadWriteTask;
|
||||
string contentAlgorithmName = base.GetContentAlgorithmName();
|
||||
KeyParameter keyParameter2;
|
||||
return keyParameter2;
|
||||
}
|
||||
OriginatorID originatorID = new OriginatorID();
|
||||
IssuerAndSerialNumber issuerAndSerialNumber = originator.IssuerAndSerialNumber;
|
||||
if (issuerAndSerialNumber == 0)
|
||||
{
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
throw new NullReferenceException();
|
||||
}
|
||||
|
||||
// Token: 0x0600A284 RID: 41604 RVA: 0x0025DBC0 File Offset: 0x0025BDC0
|
||||
[Token(Token = "0x600A284")]
|
||||
[Address(RVA = "0x65F980", Offset = "0x65E380", VA = "0x18065F980", Slot = "4")]
|
||||
public override CmsTypedStream GetContentStream(ICipherParameters key)
|
||||
{
|
||||
/*
|
||||
An exception occurred when decompiling this method (0600A284)
|
||||
|
||||
ICSharpCode.Decompiler.DecompilerException: Error decompiling BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.CmsTypedStream BestHTTP.SecureProtocol.Org.BouncyCastle.Cms.KeyAgreeRecipientInformation::GetContentStream(BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.ICipherParameters)
|
||||
|
||||
---> System.Exception: Basic block has to end with unconditional control flow.
|
||||
{
|
||||
IL_18:
|
||||
stloc:ArgumentException(var_3_27, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("KeyAgreement requires asymmetric key"), ldstr:string("key")))
|
||||
stloc:ArgumentException(var_4_37, newobj:ArgumentException(ArgumentException::.ctor, ldstr:string("Expected private key"), ldstr:string("key")))
|
||||
}
|
||||
|
||||
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: 0x04006ADE RID: 27358
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x30")]
|
||||
[Token(Token = "0x4006ADE")]
|
||||
private KeyAgreeRecipientInfo info;
|
||||
|
||||
// Token: 0x04006ADF RID: 27359
|
||||
[global::Cpp2IlInjected.FieldOffset(Offset = "0x38")]
|
||||
[Token(Token = "0x4006ADF")]
|
||||
private Asn1OctetString encryptedKey;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user