-
Notifications
You must be signed in to change notification settings - Fork 157
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
Add DER encoding/decoding support #21
Comments
I've implemented a quick version of this at https://github.com/caelunshun/rsa-der. I can look into making a PR for this. |
You might want to check out @alex's |
FYI, I intend to merge and release that soon, hopefully the next week. It
doesn't yet have encode support though.
…On Sun, Sep 1, 2019, 2:43 PM Tony Arcieri ***@***.***> wrote:
You might want to check out @alex <https://github.com/alex>'s asn1 crate
(revamp): alex/rust-asn1#54 <alex/rust-asn1#54>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#21?email_source=notifications&email_token=AAAAGBGXRDR52DYONHCIPZTQHQEOVA5CNFSM4IKGWUXKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5UIKHA#issuecomment-526943516>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAAGBHXMWKJ6ZFPMVHX3KDQHQEOVANCNFSM4IKGWUXA>
.
|
Also I think it will be worth to check out the |
Re: that, there's |
In my code I ended up using The ASN.1 key format is standardized in RFC 3447, Appendix C. Look for "RSAPrivateKey". |
@roblabla oh joy, I think you're talking about the "SSLeay format". Does it start with this?
If so, that's a bespoke PEM encoding of PKCS#1 (i.e. RFC 3447) added to SSLeay, the library which would eventually become OpenSSL. Personally I'd suggest using PKCS#8 (RFC 5208/5958) instead unless you really, really need to support the SSLeay format for something. These keys start with:
or
PKCS#8 has the advantage of being reusable for things like ECDSA (and even Ed25519). |
Well I mostly parsed what openssl gave me as an output - which is PKCS#1. I suppose we can get openssl to give us a PKCS#8? (Probably using |
If you're using the OpenSSL CLI, the PKCS#8 functionality is under |
@tarcieri would you know what's the current state of |
Ah perfect, your conversions there are exactly what I need, will add them to |
@nickray you might also look at: https://www.bearssl.org/gitweb/?p=BearSSL;a=blob_plain;f=src/rsa/rsa_pkcs1_sig_pad.c It looks like BearSSL just hardcodes the relevant ASN.1 DER. See also the relevant decoding code here: https://www.bearssl.org/gitweb/?p=BearSSL;a=blob_plain;f=src/rsa/rsa_pkcs1_sig_unpad.c |
I ended up with a manual mashup of your stuff and derp stuff, I only need ECDSA DER encoding (as the certificates can be hardcoded): https://github.com/nickray/usbd-ctaphid/blob/main/src/derpy.rs. Not super-efficient, but at least it's readable (at least for my mind). Very much hoping I don't have to dig much deeper into this, as I find myself wondering how many semi-efficient pseudo-consistent serialization formats mankind has to come up with... Funny how Microsoft has the best docs I know of on how this is supposed to work: |
I think most of this is fixed with #38 Could folks confirm if their favorite format is supported by this, or if they are still missing one? |
@dignifiedquire |
Seems like we can close this issue then? |
No description provided.
The text was updated successfully, but these errors were encountered: