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

elliptic-curve: basic OID support #240

Merged
merged 1 commit into from
Jul 31, 2020
Merged

elliptic-curve: basic OID support #240

merged 1 commit into from
Jul 31, 2020

Conversation

tarcieri
Copy link
Member

Adds a (very simple, const-and-no_std-friendly) ObjectIdentifier type and an Identifier trait for attaching an OID to a curve.

No validation of the nodes is presently performed (and since it's impl'd as a const fn, it'd require a MSRV bump to do so). Also requires the OID be specified as an array literal: no parsing is supported for either string or binary-encoded OIDs.

Only string serialization is supported for now (via Display). A no_std-friendly binary serializer will be somewhat tricky.

@tarcieri
Copy link
Member Author

I took a look at the oid crate for this, unfortunately it has a hard dependency on liballoc and no support for const initialization.

Adds a (very simple, const-and-no_std-friendly) `ObjectIdentifier` type
and an `Identifier` trait for attaching an OID to a curve.

No validation of the nodes is presently performed (and since it's impl'd
as a `const fn`, it'd require a MSRV bump to do so). Also requires the
OID be specified as an array literal: no parsing is supported for either
string or binary-encoded OIDs.

Only string serialization is supported for now. A `no_std`-friendly
binary serializer will be somewhat tricky.
@tarcieri tarcieri merged commit a65edce into master Jul 31, 2020
@tarcieri tarcieri deleted the elliptic-curve/oid branch July 31, 2020 02:30
@newpavlov
Copy link
Member

Ideally we should specify OID for other algorithms as well, so if oid is not a good fit, maybe create a separate crate for it?

@tarcieri
Copy link
Member Author

Yeah, good point, we could potentially split this out into a separate crate somewhere, although I can't think of a good name.

@newpavlov
Copy link
Member

newpavlov commented Jul 31, 2020

crypto-oid or small-oid?

@tarcieri
Copy link
Member Author

const-oid or oid-consts might describe the use case a little more specifically

tarcieri added a commit to RustCrypto/utils that referenced this pull request Aug 4, 2020
This is an extraction of the const OID support added to the
`elliptic-curve` crate in RustCrypto/traits#240.
tarcieri added a commit to RustCrypto/utils that referenced this pull request Aug 4, 2020
This is an extraction of the const OID support added to the
`elliptic-curve` crate in RustCrypto/traits#240.
@tarcieri tarcieri mentioned this pull request Aug 10, 2020
dns2utf8 pushed a commit to dns2utf8/traits that referenced this pull request Jan 24, 2023
Changes the B64 decoder to return a `Result`, returning an error if the
input is invalid instead of panicking.

Fixes RustCrypto#240
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