Files
Jan2021-Cpp2Il-Dump/Assembly-CSharp/BestHTTP/SecureProtocol/Org/BouncyCastle/Crypto/Tls/TlsRsaUtilities.cs
T
2026-04-08 23:40:05 +02:00

72 lines
2.4 KiB
C#

using System;
using System.IO;
using System.Runtime.InteropServices;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Encodings;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Engines;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Parameters;
using BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities;
using Cpp2IlInjected;
namespace BestHTTP.SecureProtocol.Org.BouncyCastle.Crypto.Tls
{
// Token: 0x020015AF RID: 5551
[Token(Token = "0x20015AF")]
[StructLayout(3)]
public abstract class TlsRsaUtilities
{
// Token: 0x060093D9 RID: 37849 RVA: 0x0020B920 File Offset: 0x00209B20
[Token(Token = "0x60093D9")]
[Address(RVA = "0x1E05020", Offset = "0x1E03A20", VA = "0x181E05020")]
public static byte[] GenerateEncryptedPreMasterSecret(TlsContext context, RsaKeyParameters rsaServerPublicKey, Stream output)
{
byte[] array = new byte[48];
int num;
array[0] = (byte)num;
char c;
bool needParenthesis = c.NeedParenthesis;
array[0] = (needParenthesis ? 1 : 0);
Pkcs1Encoding pkcs1Encoding = new Pkcs1Encoding(new RsaBlindedEngine());
ParametersWithRandom parametersWithRandom;
pkcs1Encoding.Init(true, parametersWithRandom);
int length = array.Length;
int num2 = 0;
byte[] array2 = pkcs1Encoding.ProcessBlock(array, num2, length);
bool flag;
if (!flag)
{
TlsUtilities.WriteOpaque16(array2, output);
}
int num3 = output.ReadByte();
return array;
}
// Token: 0x060093DA RID: 37850 RVA: 0x0020B998 File Offset: 0x00209B98
[Token(Token = "0x60093DA")]
[Address(RVA = "0x1E05340", Offset = "0x1E03D40", VA = "0x181E05340")]
public static byte[] SafeDecryptPreMasterSecret(TlsContext context, RsaKeyParameters rsaServerPrivateKey, byte[] encryptedPreMasterSecret)
{
byte[] array = new byte[48];
byte[] array2 = Arrays.Clone(array);
Pkcs1Encoding pkcs1Encoding = new Pkcs1Encoding(new RsaBlindedEngine(), array);
int num = 0;
ParametersWithRandom parametersWithRandom;
pkcs1Encoding.Init(num != 0, parametersWithRandom);
int length = encryptedPreMasterSecret.Length;
int num2 = 0;
byte[] array3 = pkcs1Encoding.ProcessBlock(encryptedPreMasterSecret, num2, length);
int num3 = 0;
byte b;
array3[0] = b;
num3++;
return array3;
}
// Token: 0x060093DB RID: 37851 RVA: 0x0020BA18 File Offset: 0x00209C18
[Token(Token = "0x60093DB")]
[Address(RVA = "0x3C1670", Offset = "0x3C0070", VA = "0x1803C1670")]
protected TlsRsaUtilities()
{
}
}
}