Skip to content

Reset server MAC after TransformFinalBlock on .NET FW - #1830

Open
scott-xu wants to merge 1 commit into
sshnet:developfrom
scott-xu:fix/initialize-mac-netframework
Open

Reset server MAC after TransformFinalBlock on .NET FW#1830
scott-xu wants to merge 1 commit into
sshnet:developfrom
scott-xu:fix/initialize-mac-netframework

Conversation

@scott-xu

Copy link
Copy Markdown
Collaborator

Call _serverMac.Initialize() after TransformFinalBlock when running on .NET Framework. This ensures the MAC is properly reset, addressing differences in cryptographic API behavior across different versions of mscorlib.dll.

Close #1829

Comment thread src/Renci.SshNet/Session.cs Outdated
@scott-xu
scott-xu force-pushed the fix/initialize-mac-netframework branch from b407a2d to f8d1e3b Compare August 24, 2026 13:14
Add `#if NETFRAMEWORK` block to call `_serverMac.Initialize()` after `TransformFinalBlock` in `ReceiveMessage`. Ensures MAC is reset for reuse, addressing issues on older .NET Framework builds (e.g., mscorlib.dll 4.8.4110.0).
@scott-xu
scott-xu force-pushed the fix/initialize-mac-netframework branch from f8d1e3b to b0a4569 Compare August 24, 2026 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MAC error / CryptographicException on .NET Framework in 2026.0.0: _serverMac is reused across packets without Initialize()

2 participants