Repository navigation
Accept negative ENUMERATED values, make PKCS12 write iterations configurable, and wipe transient key material - #216
Merged
Conversation
…gurable, and wipe transient key material DerEnumerated now accepts negative values per X.690 signed-integer encoding and gains TryGetIntValueExact. Asn1Dumper gains AppendAsString overloads so callers can build into an existing buffer. The HMAC k-calculator wipes the private scalar bytes after seeding. PKCS12 write-side iteration counts are driven by a configurable StoreIterationCount. Adds ML-DSA and SLH-DSA component encoding-length tests and a negative-ENUMERATED round-trip test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Several independent hardening and correctness changes to ASN.1 handling, PKCS#12 writing, and key hygiene.
ASN.1 ENUMERATED
DerEnumeratednow accepts negative values. X.690 encodes an ENUMERATED as a signed integer, so a negative value is well formed; the previous non-negative check rejected valid encodings. The malformed-encoding check is retained.TryGetIntValueExacttoIDerEnumerated, withGetIntValueExactdelegating to it.ASN.1 dumping
Asn1DumpergainsAppendAsStringoverloads so callers can build into an existing buffer;DumpAsStringdelegates to them.X509Certificate.ToStringuses the new path.Key hygiene
PKCS#12 write iterations
TCryptoLibConfig.Pkcs12.StoreIterationCount(default 300000, MAC uses twice the key/cert count, clamped to a sane range). On load, a verified file's MAC configuration is latched and reproduced on save.Tests