Repository navigation
Description
Summary
Add .NET wrappers for yescrypt and PBKDF2-HMAC-SHA256/384/512.
Blocked by: Cryptographic-API-Services/cas-core-lib#156 (cas-core-lib exports), which is blocked by Cryptographic-API-Services/cas-lib#161, and a cas-core-lib release that includes it.
Upstream
cas-lib: Cryptographic-API-Services/cas-lib#161 (Password hashing: yescrypt and PBKDF2 with HMAC-SHA-2). Not implemented in cas-lib yet; this issue tracks exposing it once it ships.
API shape in cas-lib: New PBKDF2 functions alongside the existing HMAC-SHA3-256 derivation (unchanged), and a CASPasswordHasher-style yescrypt type returning PHC-style strings.
Scope
- PBKDF2-HMAC-SHA256, -SHA384, -SHA512 (random salt, caller salt)
- yescrypt hash / verify with bounded parameters
Feature-specific notes
- Needs the existing PBKDF2 export first (see the PBKDF2 catch-up issue). The SHA-2 PRFs are what .NET
Rfc2898DeriveBytesand WebCrypto produce, so add a cross-check against the platform API in the SDK tests.
Tests
Run the same vectors cas-lib uses through this repo's harness: Wycheproof pbkdf2_hmacsha256_test.json, pbkdf2_hmacsha384_test.json, pbkdf2_hmacsha512_test.json; yescrypt reference vectors and an mkpasswd -m yescrypt hash.
Implementation notes (cas-dotnet-sdk conventions, see CLAUDE.md)
- Bump the
cas-core-libsubmodule to the cas-core-lib release that contains the exports, and commit the regeneratedcas-dotnet-sdk/generated/NativeMethods.g.cs(the PR workflows fail if it is stale). - Wrapper class (plus result types under
Types/) that marshals throughNativePin/NativeByteBufferand frees every returned buffer in afinally(or with the matchingfree_<struct>). - Keep secrets in
byte[]/Span<byte>, neverstring; clear them withCryptographicOperations.ZeroMemoryafter use and pin them while they cross the FFI. - Errors surface through
CasErrorHandler/CasException; add aCasErrorCodemember for any new cas-core-lib error code. - Add a usage sample to
docs/EXAMPLES.mdand a benchmark class undercas-dotnet-sdk-benchmarks/Benchmarks/.
Acceptance criteria
- CI green on Linux, Windows and macOS (
--lockedbuilds). - PR title follows Conventional Commits. Don't bump the version or edit
CHANGELOG.mdby hand; release-please does that.
Activity