Skip to content

Commit aefa839

Browse files
committed
Old unity support
1 parent 9f2fe45 commit aefa839

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Assets/Mirror/Transports/Encryption/Native/AesGCMEncryptionNative.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ static AesGCMEncryptionNative()
4040
public static bool IsSupported => _supported;
4141
public static unsafe ArraySegment<byte> Encrypt(byte[] key, byte[] nonce, ArraySegment<byte> plaintext, ArraySegment<byte> dataOut)
4242
{
43-
plaintext.CopyTo(dataOut);
43+
Array.Copy(plaintext.Array, plaintext.Offset, dataOut.Array, dataOut.Offset ,plaintext.Count);
4444
fixed (byte* keyPtr = key)
4545
{
4646
fixed (byte* noncePtr = nonce)
@@ -57,9 +57,10 @@ public static unsafe ArraySegment<byte> Encrypt(byte[] key, byte[] nonce, ArrayS
5757
}
5858
}
5959
}
60+
6061
public static unsafe ArraySegment<byte> Decrypt(byte[] key, byte[] nonce, ArraySegment<byte> ciphertext, ArraySegment<byte> dataOut)
6162
{
62-
ciphertext.CopyTo(dataOut);
63+
Array.Copy(ciphertext.Array, ciphertext.Offset, dataOut.Array, dataOut.Offset, ciphertext.Count);
6364
fixed (byte* keyPtr = key)
6465
{
6566
fixed (byte* noncePtr = nonce)

0 commit comments

Comments
 (0)