123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #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
|