Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/constistent api #130

Merged
merged 20 commits into from
Sep 20, 2024
Merged

Feature/constistent api #130

merged 20 commits into from
Sep 20, 2024

Conversation

JesusMcCloud
Copy link
Collaborator

Consistent encoding and decoding api, including parsing only the first element from a bytearray

CHANGELOG.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
indispensable-cosef/build.gradle.kts Outdated Show resolved Hide resolved
indispensable/build.gradle.kts Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@JesusMcCloud
Copy link
Collaborator Author

i did not directly commti your suggestions but added them manually into my commit

@iaik-jheher
Copy link
Collaborator

i did not directly commti your suggestions but added them manually into my commit

that's preferable anyway 👍

@JesusMcCloud JesusMcCloud merged commit 545ba31 into development Sep 20, 2024
6 checks passed
@iaik-jheher iaik-jheher deleted the feature/constistentAPI branch September 20, 2024 12:40
JesusMcCloud added a commit that referenced this pull request Sep 20, 2024
* Revamp `Asn1Element.parse()`, introducing new variants. This yields:
  * `Asn1Element.parse()` with the same semantics as before
  * `Asn1Element.parse()` alternative introduced, which takes a `ByteIterator` instead of a `ByteArray`
  * `Asn1Element.parseAll()` introduced, which consumes all bytes and returns a list of all ASN.1 elements (if parsing works)
    * Variant 1 takes a `ByteIterator`
    * Variant 2 takes a `ByteArray`
  * `Asn1Element.parseFirst()` introduced, which tries to only parse a single ASN.1 element from the input and leaves the rest untouched.
    * Variant 1 takes a `ByteIterator` and returns the element; the `ByteIterator` is advanced accordingly
    * Variant 2 takes a `ByteArray` and returns a `Pair` of `(element, remainingBytes)`
* More consistent low-level encoding and decoding function names:
  * `encodeToAsn1Primitive` to produce an `Asn1Primitive` that can directly be DER-encoded
  * `encodeToAsn1ContentBytes` to produce the content bytes of a TLV primitive (the _V_ in TLV)
  * `decodeToXXX` to be invoked on an `Asn1Primitive` to decode a DER-encoded primitive into the target type
  * `decodeFromAsn1ContentBytes` to be invoked on the companion of the target type to decode the content bytes of a TLV primitive (the _V_ in TLV)
* Update conventions -> Coroutines 1.0.9

---------

Co-authored-by: Jakob Heher <[email protected]>
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.

2 participants