Photon Server API Documentation v5.0RC1

Public Member Functions | Static Public Member Functions | List of all members
Photon.SocketServer.Security.Encryptor Class Reference

Implemenation of encryption for UDP trafic More...

Inheritance diagram for Photon.SocketServer.Security.Encryptor:
Photon.SocketServer.Security.CryptoBase

Public Member Functions

void Encrypt (byte[] data, int srcOffset, int len, byte[] output, ref int outputOffset)
 Encrypts data. puts them into output buffer and prepends with IV More...
 
void Encrypt (byte[] data, int len, byte[] output, ref int offset)
 Encrypts data. puts them into output buffer and prepends with IV More...
 
byte[] FinishHMAC (byte[] data, int offset, int count)
 Finishes current HMAC. can be used for HMAC calculation if all data are in same buffer More...
 
byte[] FinishHMACThreadSafe (byte[] data, int offset, int count)
 
- Public Member Functions inherited from Photon.SocketServer.Security.CryptoBase
void Init (byte[] encryptionSecret, byte[] hmacSecret)
 Initialize More...
 
void Dispose ()
 

Static Public Member Functions

static int EncryptedDataSize (int dataLen)
 
static int EncryptedDataSizeWithIV (int dataLen)
 

Additional Inherited Members

- Static Public Attributes inherited from Photon.SocketServer.Security.CryptoBase
const int BLOCK_SIZE = 16
 Defines block size for encryption/decryption algorithm More...
 
const int IV_SIZE = BLOCK_SIZE
 Defines IV size for encryption/decryption algorithm More...
 
const int HMAC_SIZE = 32
 Defines HMAC size for packet authentication algorithm More...
 
- Protected Attributes inherited from Photon.SocketServer.Security.CryptoBase
Aes encryptor
 Encryption/decryption algorithm implementation More...
 
HMACSHA256 hmacsha256
 Packet authentication algorithm impelmenation More...
 

Detailed Description

Implemenation of encryption for UDP trafic

Member Function Documentation

◆ Encrypt() [1/2]

void Photon.SocketServer.Security.Encryptor.Encrypt ( byte[]  data,
int  len,
byte[]  output,
ref int  offset 
)
inline

Encrypts data. puts them into output buffer and prepends with IV

Parameters
data
len
output
offset
Returns

Thread safe. Can be used for inplace encryption

◆ Encrypt() [2/2]

void Photon.SocketServer.Security.Encryptor.Encrypt ( byte[]  data,
int  srcOffset,
int  len,
byte[]  output,
ref int  outputOffset 
)
inline

Encrypts data. puts them into output buffer and prepends with IV

Parameters
dataincoming data
srcOffsetoffset from the begining
lenlength of data
outputbuffer where to put result
outputOffsetoffset in result buffer
Returns

Thread safe. Can be used for inplace encryption

◆ EncryptedDataSize()

static int Photon.SocketServer.Security.Encryptor.EncryptedDataSize ( int  dataLen)
inlinestatic

◆ EncryptedDataSizeWithIV()

static int Photon.SocketServer.Security.Encryptor.EncryptedDataSizeWithIV ( int  dataLen)
inlinestatic

◆ FinishHMAC()

byte [] Photon.SocketServer.Security.Encryptor.FinishHMAC ( byte[]  data,
int  offset,
int  count 
)
inline

Finishes current HMAC. can be used for HMAC calculation if all data are in same buffer

Parameters
databuffer with data
offsetoffset in buffer
countcount byte to use from buffer
Returns
calculated HASH

◆ FinishHMACThreadSafe()

byte [] Photon.SocketServer.Security.Encryptor.FinishHMACThreadSafe ( byte[]  data,
int  offset,
int  count 
)
inline