66 lines
1.4 KiB
C#
66 lines
1.4 KiB
C#
using System;
|
|
using System.Security.Cryptography;
|
|
|
|
namespace ExitGames.Client.Photon.EncryptorManaged
|
|
{
|
|
// Token: 0x0200003A RID: 58
|
|
public class CryptoBase : IDisposable
|
|
{
|
|
// Token: 0x060002B8 RID: 696 RVA: 0x00013CD8 File Offset: 0x00011ED8
|
|
~CryptoBase()
|
|
{
|
|
this.Dispose(false);
|
|
}
|
|
|
|
// Token: 0x060002B9 RID: 697 RVA: 0x00013D0C File Offset: 0x00011F0C
|
|
public void Init(byte[] encryptionSecret, byte[] hmacSecret)
|
|
{
|
|
this.encryptor = new AesManaged
|
|
{
|
|
Key = encryptionSecret
|
|
};
|
|
this.encryptor.GenerateIV();
|
|
this.hmacsha256 = new HMACSHA256(hmacSecret);
|
|
}
|
|
|
|
// Token: 0x060002BA RID: 698 RVA: 0x00013D3A File Offset: 0x00011F3A
|
|
public void Dispose()
|
|
{
|
|
this.Dispose(true);
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
// Token: 0x060002BB RID: 699 RVA: 0x00013D4C File Offset: 0x00011F4C
|
|
private void Dispose(bool dispose)
|
|
{
|
|
bool flag = this.encryptor != null;
|
|
if (flag)
|
|
{
|
|
this.encryptor.Clear();
|
|
this.encryptor = null;
|
|
}
|
|
bool flag2 = this.hmacsha256 != null;
|
|
if (flag2)
|
|
{
|
|
this.hmacsha256.Clear();
|
|
this.hmacsha256 = null;
|
|
}
|
|
}
|
|
|
|
// Token: 0x0400017E RID: 382
|
|
public const int BLOCK_SIZE = 16;
|
|
|
|
// Token: 0x0400017F RID: 383
|
|
public const int IV_SIZE = 16;
|
|
|
|
// Token: 0x04000180 RID: 384
|
|
public const int HMAC_SIZE = 32;
|
|
|
|
// Token: 0x04000181 RID: 385
|
|
protected Aes encryptor;
|
|
|
|
// Token: 0x04000182 RID: 386
|
|
protected HMACSHA256 hmacsha256;
|
|
}
|
|
}
|