add all
This commit is contained in:
51
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/tls/crypto/TlsMacSink.cs
vendored
Normal file
51
Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/tls/crypto/TlsMacSink.cs
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
|
||||
#pragma warning disable
|
||||
using System;
|
||||
|
||||
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Utilities.IO;
|
||||
|
||||
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto
|
||||
{
|
||||
public class TlsMacSink
|
||||
: BaseOutputStream
|
||||
{
|
||||
private readonly TlsMac m_mac;
|
||||
|
||||
public TlsMacSink(TlsMac mac)
|
||||
{
|
||||
this.m_mac = mac;
|
||||
}
|
||||
|
||||
public virtual TlsMac Mac
|
||||
{
|
||||
get { return m_mac; }
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
Streams.ValidateBufferArguments(buffer, offset, count);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
m_mac.Update(buffer, offset, count);
|
||||
}
|
||||
}
|
||||
|
||||
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER || UNITY_2021_2_OR_NEWER
|
||||
public override void Write(ReadOnlySpan<byte> buffer)
|
||||
{
|
||||
if (!buffer.IsEmpty)
|
||||
{
|
||||
m_mac.Update(buffer);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
m_mac.Update(new byte[]{ value }, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore
|
||||
#endif
|
||||
Reference in New Issue
Block a user