Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a C# P/Invoke wrapper for HPKE (RFC 9180) plus a console-style test that exercises Base mode seal/open and public-key serialization round-trip.
Changes:
- Added HPKE native imports and managed helper APIs (init, keygen, serialize/deserialize, seal/open, free).
- Added HPKE Base mode test flow to the C# test runner.
- Enabled
HAVE_HPKEin the C# wrapper user settings.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| wrapper/CSharp/wolfSSL_CSharp/wolfCrypt.cs | Adds HPKE P/Invoke bindings and managed convenience APIs for base-mode single-shot operations |
| wrapper/CSharp/wolfCrypt-Test/wolfCrypt-Test.cs | Adds an HPKE base-mode functional test (keygen, serialize/deserialize, seal/open) |
| wrapper/CSharp/user_settings.h | Enables HPKE in the C# wrapper build configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| using System; | ||
| using System.Collections.Concurrent; | ||
| using System.Runtime.InteropServices; |
There was a problem hiding this comment.
System.Collections.Concurrent is used unconditionally, but this wrapper has #if WindowsCE support throughout the file. ConcurrentDictionary is not available on .NET Compact Framework/Windows CE, so defining WindowsCE will fail to compile. Consider wrapping the HPKE context tracking in #if !WindowsCE (or multi-targeting) and using a simpler Dictionary<IntPtr, HpkeContextState> + lock (or another CF-compatible collection) for WindowsCE builds.
| if (plaintext == null || plaintext.Length == 0) | ||
| { | ||
| log(ERROR_LOG, "HPKE seal base: invalid plaintext"); | ||
| return null; | ||
| } |
There was a problem hiding this comment.
HpkeSealBase currently rejects plaintext.Length == 0, but HPKE (and the native wc_HpkeSealBase API) can validly seal an empty plaintext (ciphertext would be just the AEAD tag). Consider allowing zero-length plaintexts (keep rejecting plaintext == null) so callers can encrypt empty messages and so the wrapper matches the native API semantics.
Description
Add HPKE (RFC 9180) C# wrapper and tests
Testing
Done with CSharp tests
Checklist