Class CryptoAES
Encryptor based on 256-bit Advanced Encryption Standard (AES).
Inheritance
Namespace: SuperNet.Netcode.Crypto
Assembly: cs.temp.dll.dll
Syntax
public sealed class CryptoAES : ICryptoEncryptor, IDisposable
Constructors
CryptoAES(Byte[], Allocator)
Create a new AES encryptor with the provided key.
Declaration
public CryptoAES(byte[] key, Allocator allocator)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Byte[] | key | Encryption key to use. |
| Allocator | allocator | Allocator to use for allocating keys. |
Methods
Decrypt(ArraySegment<Byte>, Byte[], Int32)
Decrypt data.
Declaration
public int Decrypt(ArraySegment<byte> input, byte[] output, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| ArraySegment<System.Byte> | input | Array segment to decrypt. |
| System.Byte[] | output | Output buffer to write to. |
| System.Int32 | offset | Output offset to write to. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Total number of bytes written to the output. |
Dispose()
Instantly dispose of all resources.
Declaration
public void Dispose()
Encrypt(ArraySegment<Byte>, Byte[], Int32)
Encrypt data.
Declaration
public int Encrypt(ArraySegment<byte> input, byte[] output, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| ArraySegment<System.Byte> | input | Array segment to encrypt. |
| System.Byte[] | output | Output buffer to write to. |
| System.Int32 | offset | Output offset to write to. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Total number of bytes written to the output. |
MaxDecryptedLength(Int32)
Compute the maximum decrypted length before decrypting.
Declaration
public int MaxDecryptedLength(int inputLength)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | inputLength | Length of the input that is about to be decrypted. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Maximum possible decrypted length. |
MaxEncryptedLength(Int32)
Compute the maximum encrypted length before encrypting.
Declaration
public int MaxEncryptedLength(int inputLength)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | inputLength | Length of the input that is about to be encrypted. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Maximum possible encrypted length. |