158 lines
5.1 KiB
C#
158 lines
5.1 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
|
|
using BestHTTP.SecureProtocol.Org.BouncyCastle.Math;
|
|
using Cpp2IlInjected;
|
|
|
|
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines
|
|
{
|
|
// Token: 0x020016C7 RID: 5831
|
|
[Token(Token = "0x20016C7")]
|
|
[StructLayout(3)]
|
|
public class RsaBlindingEngine : IAsymmetricBlockCipher
|
|
{
|
|
// Token: 0x06009C8D RID: 40077 RVA: 0x0023864C File Offset: 0x0023684C
|
|
[Token(Token = "0x6009C8D")]
|
|
[Address(RVA = "0x20FD060", Offset = "0x20FBA60", VA = "0x1820FD060")]
|
|
public RsaBlindingEngine()
|
|
{
|
|
RsaCoreEngine rsaCoreEngine = new RsaCoreEngine();
|
|
base..ctor();
|
|
this.core = rsaCoreEngine;
|
|
}
|
|
|
|
// Token: 0x06009C8E RID: 40078 RVA: 0x0023866C File Offset: 0x0023686C
|
|
[Token(Token = "0x6009C8E")]
|
|
[Address(RVA = "0x3C3A30", Offset = "0x3C2430", VA = "0x1803C3A30")]
|
|
public RsaBlindingEngine(IRsa rsa)
|
|
{
|
|
this.core = rsa;
|
|
}
|
|
|
|
// Token: 0x170018E7 RID: 6375
|
|
// (get) Token: 0x06009C8F RID: 40079 RVA: 0x00238688 File Offset: 0x00236888
|
|
[Token(Token = "0x170018E7")]
|
|
public virtual string AlgorithmName
|
|
{
|
|
[Token(Token = "0x6009C8F")]
|
|
[Address(RVA = "0x20FD0C0", Offset = "0x20FBAC0", VA = "0x1820FD0C0", Slot = "9")]
|
|
get
|
|
{
|
|
return "RSA";
|
|
}
|
|
}
|
|
|
|
// Token: 0x06009C90 RID: 40080 RVA: 0x0023869C File Offset: 0x0023689C
|
|
[Token(Token = "0x6009C90")]
|
|
[Address(RVA = "0x20FCCC0", Offset = "0x20FB6C0", VA = "0x1820FCCC0", Slot = "10")]
|
|
public virtual void Init(bool forEncryption, ICipherParameters param)
|
|
{
|
|
int num;
|
|
for (;;)
|
|
{
|
|
if ((param != 0 || param != 0) && param != 0 && param != 0)
|
|
{
|
|
num = 0;
|
|
if (param != 0)
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
IRsa rsa = this.core;
|
|
this.forEncryption = forEncryption;
|
|
this.key = num;
|
|
this.blindingFactor = num;
|
|
}
|
|
|
|
// Token: 0x06009C91 RID: 40081 RVA: 0x002386F0 File Offset: 0x002368F0
|
|
[Token(Token = "0x6009C91")]
|
|
[Address(RVA = "0x20FCC20", Offset = "0x20FB620", VA = "0x1820FCC20", Slot = "11")]
|
|
public virtual int GetInputBlockSize()
|
|
{
|
|
IRsa rsa = this.core;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009C92 RID: 40082 RVA: 0x0023870C File Offset: 0x0023690C
|
|
[Token(Token = "0x6009C92")]
|
|
[Address(RVA = "0x20FCC70", Offset = "0x20FB670", VA = "0x1820FCC70", Slot = "12")]
|
|
public virtual int GetOutputBlockSize()
|
|
{
|
|
IRsa rsa = this.core;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009C93 RID: 40083 RVA: 0x00238728 File Offset: 0x00236928
|
|
[Token(Token = "0x6009C93")]
|
|
[Address(RVA = "0x20FCEB0", Offset = "0x20FB8B0", VA = "0x1820FCEB0", Slot = "13")]
|
|
public virtual byte[] ProcessBlock(byte[] inBuf, int inOff, int inLen)
|
|
{
|
|
IRsa rsa = this.core;
|
|
RsaKeyParameters rsaKeyParameters = this.key;
|
|
if (!this.forEncryption)
|
|
{
|
|
BigInteger bigInteger = this.blindingFactor;
|
|
BigInteger modulus = rsaKeyParameters.modulus;
|
|
BigInteger bigInteger2 = bigInteger.ModInverse(modulus);
|
|
}
|
|
BigInteger bigInteger3 = this.blindingFactor;
|
|
BigInteger modulus2 = rsaKeyParameters.modulus;
|
|
BigInteger exponent = rsaKeyParameters.exponent;
|
|
BigInteger bigInteger4 = bigInteger3.ModPow(exponent, modulus2);
|
|
BigInteger modulus3 = this.key.modulus;
|
|
BigInteger bigInteger6;
|
|
BigInteger bigInteger5 = bigInteger6.Mod(modulus3);
|
|
IRsa rsa2 = this.core;
|
|
throw new NullReferenceException();
|
|
}
|
|
|
|
// Token: 0x06009C94 RID: 40084 RVA: 0x002387B0 File Offset: 0x002369B0
|
|
[Token(Token = "0x6009C94")]
|
|
[Address(RVA = "0x20FCBA0", Offset = "0x20FB5A0", VA = "0x1820FCBA0")]
|
|
private BigInteger BlindMessage(BigInteger msg)
|
|
{
|
|
RsaKeyParameters rsaKeyParameters = this.key;
|
|
BigInteger bigInteger = this.blindingFactor;
|
|
BigInteger modulus = rsaKeyParameters.modulus;
|
|
BigInteger exponent = rsaKeyParameters.exponent;
|
|
BigInteger bigInteger2 = bigInteger.ModPow(exponent, modulus);
|
|
BigInteger bigInteger3 = msg.Multiply(bigInteger2);
|
|
BigInteger modulus2 = this.key.modulus;
|
|
return bigInteger3.Mod(modulus2);
|
|
}
|
|
|
|
// Token: 0x06009C95 RID: 40085 RVA: 0x0023880C File Offset: 0x00236A0C
|
|
[Token(Token = "0x6009C95")]
|
|
[Address(RVA = "0x20FCFF0", Offset = "0x20FB9F0", VA = "0x1820FCFF0")]
|
|
private BigInteger UnblindMessage(BigInteger blindedMsg)
|
|
{
|
|
RsaKeyParameters rsaKeyParameters = this.key;
|
|
BigInteger bigInteger = this.blindingFactor;
|
|
BigInteger modulus = rsaKeyParameters.modulus;
|
|
BigInteger bigInteger2 = bigInteger.ModInverse(modulus);
|
|
return blindedMsg.Multiply(bigInteger2).Mod(modulus);
|
|
}
|
|
|
|
// Token: 0x040066A6 RID: 26278
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x10")]
|
|
[Token(Token = "0x40066A6")]
|
|
private readonly IRsa core;
|
|
|
|
// Token: 0x040066A7 RID: 26279
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x18")]
|
|
[Token(Token = "0x40066A7")]
|
|
private RsaKeyParameters key;
|
|
|
|
// Token: 0x040066A8 RID: 26280
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x20")]
|
|
[Token(Token = "0x40066A8")]
|
|
private BigInteger blindingFactor;
|
|
|
|
// Token: 0x040066A9 RID: 26281
|
|
[global::Cpp2IlInjected.FieldOffset(Offset = "0x28")]
|
|
[Token(Token = "0x40066A9")]
|
|
private bool forEncryption;
|
|
}
|
|
}
|