SshPacketWriter¶
Constructors¶
create¶
Returns¶
- SshPacketWriter iso^
Public Functions¶
set_encrypt_ctx¶
Parameters¶
- ctx: SshCipherContext ref
- is_aead: Bool val = true
Returns¶
- None val
set_chacha20_poly1305¶
Set up chacha20-poly1305@openssh.com encryption. The context carries both keys; the packet sequence number is the nonce. There is no separate IV or MAC key. Packets align packet_length to an 8-byte boundary.
Parameters¶
- ctx: SshChacha20Poly1305Context ref
Returns¶
- None val
set_gcm_params¶
Set up per-packet GCM encryption. A fresh cipher context is created per packet. iv must be 12 bytes. The last 8 bytes are incremented per packet.
Parameters¶
Returns¶
- None val
set_stream_cipher¶
Set up streaming encryption (CTR) with HMAC. The cipher context persists across packets. MAC is HMAC-SHA256 or HMAC-SHA512.
fun ref set_stream_cipher(
ctx: SshCipherContext ref,
mac_key: Array[U8 val] val,
mac_len: USize val,
use_sha512: Bool val = false)
: None val
Parameters¶
- ctx: SshCipherContext ref
- mac_key: Array[U8 val] val
- mac_len: USize val
- use_sha512: Bool val = false
Returns¶
- None val
write¶
Frame a payload into an SSH binary packet. Returns the complete packet bytes ready for TCP.
Parameters¶
Returns¶
sequence_number¶
Returns¶
- U32 val
reset_sequence_number¶
Reset the outgoing sequence number to zero. Used after sending NEWKEYS under strict key exchange (Terrapin / CVE-2023-48795 mitigation), so the first packet under a new key starts at sequence 0.
Returns¶
- None val