ASN.1: RFC 8410 OIDs, ABSENT params, Unknown key preservation, SEQUENCE OF support #108
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
ObjectIdentifier
extensions: Ed25519, Ed448, X25519, X448.Asn1Any
).Issue linkage
StructureKind.LIST
).UnknownKeyAlgorithmIdentifier(algorithm, parameters)
andAsn1Any
to preserve parameters.Details
RFC 8410 OIDs and encoding rules
asn1/modules
:ObjectIdentifier.Companion.Ed25519
→ 1.3.101.112ObjectIdentifier.Companion.Ed448
→ 1.3.101.113ObjectIdentifier.Companion.X25519
→ 1.3.101.110ObjectIdentifier.Companion.X448
→ 1.3.101.111internal fun ObjectIdentifier.isRfc8410NoParams()
groups the four OIDs.KeyAlgorithmIdentifierSerializer.encodeParameters
omits the "parameters" element for these OIDs (ABSENT). RSA remains explicit NULL; EC unchanged.UnknownKeyAlgorithmIdentifier
.Unknown AlgorithmIdentifier preservation (round‑trip)
Asn1Any
captures raw TLV bytes of unknown parameters.UnknownKeyAlgorithmIdentifier
now storesparameters: Any?
(previouslyNothing?
), usingAsn1Any
when present.parameters
isAsn1Any
, write it back as‑is; if null, omit.SEQUENCE OF (lists)
DerDecoder
andDerEncoder
now handleStructureKind.LIST
to encode/decodeSEQUENCE OF
values.Tests
SEQUENCE OF INTEGER
encode/decode (+ empty list).CI
.github/workflows/run-tests-asn1.yml
runs quick, focused matrix for ASN.1 core and modules: JVM, JS, Wasm Node, Linux x64.run-checks.yml
(runs after build) to increase cross‑platform confidence without slowing the entire pipeline.API / ABI notes
dev.whyoleg.cryptography.serialization.asn1.Asn1Any
(core ASN.1 module).UnknownKeyAlgorithmIdentifier
signature changed:UnknownKeyAlgorithmIdentifier(algorithm: ObjectIdentifier)
withparameters: Nothing?
UnknownKeyAlgorithmIdentifier(algorithm: ObjectIdentifier, parameters: Any? = null)
cryptography-serialization-asn1-modules
(API files updated). Typical use sites constructing unknown identifiers remain source‑compatible if they do not reference the oldparameters
type; call sites with 1‑arg constructor continue to work.Motivation and outcomes
Examples
30 05 06 03 2B 65 70
(no parameters element).30 05 06 03 2B 65 6E
.Backward compatibility notes
UnknownKeyAlgorithmIdentifier.parameters
being alwaysnull
, it may now holdAsn1Any
for unknown algorithms with present parameters. Consumers can ignoreparameters
or recognizeAsn1Any
to access raw TLV bytes when needed.Checklist against #21