Files
ichni_Official/Packages/com.tivadar.best.http/Runtime/3rdParty/BouncyCastle/tls/HandshakeMessageInput.cs
2026-06-15 18:18:16 +08:00

46 lines
1.2 KiB
C#

#if !BESTHTTP_DISABLE_ALTERNATE_SSL && (!UNITY_WEBGL || UNITY_EDITOR)
#pragma warning disable
using System;
using System.IO;
using Best.HTTP.SecureProtocol.Org.BouncyCastle.Tls.Crypto;
namespace Best.HTTP.SecureProtocol.Org.BouncyCastle.Tls
{
// TODO Rewrite without MemoryStream
public sealed class HandshakeMessageInput
: MemoryStream
{
private readonly int m_offset;
internal HandshakeMessageInput(byte[] buf, int offset, int length)
: base(buf, offset, length, false, true)
{
m_offset = offset;
}
public void UpdateHash(TlsHash hash)
{
WriteTo(new TlsHashSink(hash));
}
internal void UpdateHashPrefix(TlsHash hash, int bindersSize)
{
byte[] buf = GetBuffer();
int count = Convert.ToInt32(Length);
hash.Update(buf, m_offset, count - bindersSize);
}
internal void UpdateHashSuffix(TlsHash hash, int bindersSize)
{
byte[] buf = GetBuffer();
int count = Convert.ToInt32(Length);
hash.Update(buf, m_offset + count - bindersSize, bindersSize);
}
}
}
#pragma warning restore
#endif