init commit

This commit is contained in:
2025-10-09 09:57:24 +09:00
commit 4d551bd74f
6636 changed files with 1218703 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using System;
using System.IO;
namespace Org.BouncyCastle.Crypto.Tls;
public class HeartbeatExtension
{
protected readonly byte mMode;
public virtual byte Mode => mMode;
public HeartbeatExtension(byte mode)
{
if (!HeartbeatMode.IsValid(mode))
{
throw new ArgumentException("not a valid HeartbeatMode value", "mode");
}
mMode = mode;
}
public virtual void Encode(Stream output)
{
TlsUtilities.WriteUint8(mMode, output);
}
public static HeartbeatExtension Parse(Stream input)
{
byte b = TlsUtilities.ReadUint8(input);
if (!HeartbeatMode.IsValid(b))
{
throw new TlsFatalAlert(47);
}
return new HeartbeatExtension(b);
}
}