-
Notifications
You must be signed in to change notification settings - Fork 136
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
x509-cert: add certificate builder #764
x509-cert: add certificate builder #764
Conversation
This is very much a work in progress, but sharing early to get feedback. I think I want to attached the extensions to the I don't exactly know how much we want to force in that API. I'm inclined to force the inclusion of:
I'm not sure about:
Pretty convinced I can't force:
|
2c89de5
to
ad06b76
Compare
@baloo there was a little bit of previous discussion on iqlusioninc/yubikey.rs#348 as linked from #418. One thing I'd recommend is running the generated certificates through a tool like |
Also @str4d's I think if we make a good enough replacement he'll also give us the |
I've started a What are your thoughts on https://docs.rs/ouroboros/latest/ouroboros/attr.self_referencing.html. Wondering whether I should keep both the |
There's a binary here: https://github.com/zmap/zlint/releases/download/v3.4.0/zlint_3.4.0_Linux_x86_64.tar.gz You can look at this as an example for how to download it in a GitHub Actions workflow: https://github.com/RustCrypto/actions/blob/master/cargo-hack-install/action.yml It's fine to just put it in the
I played with trying to integrate See #734 where I proposed Alternatively we could eliminate the lifetimes on the various types and move to entirely owned types. I opened #765 to discuss that. |
a44db20
to
111c526
Compare
I think I like the yoke a bit better than going to owned types. |
The owned types are actually nice when decoding from PEM, since they avoid an intermediate PEM -> DER pass and allow the DER to be decoded from PEM on-the-fly as needed to parse document. |
a8c8cb6
to
cd1bf94
Compare
Got the root CA profile to work with zero lint error on zlint. |
c00659b
to
240c0f9
Compare
(minimal-versions error is a regression in nightly: rust-lang/rust#104759) |
240c0f9
to
61fe940
Compare
aeb2cf8
to
1e4b92e
Compare
It feels like doing so would inhibit the usage of this API for use cases other than Web PKI. Which would be a shame because I suspect Web PKI will be one of the last environments where this crate will be adopted. Go's crypto/x509 offers one of the best APIs for parsing and generating X.509 certificate for arbitrary use cases. It'd be great if this crate could analogous functionality. |
1e4b92e
to
74dcf8e
Compare
@brandonweeks I implemented an |
f803168
to
37b45da
Compare
Finished a readthrough pass. Looking good so far. It's a lot of code! |
@@ -0,0 +1,195 @@ | |||
use serde::{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI, I snagged https://crates.io/crates/zlint
Might be interesting to extract this into a separate crate (after landing this PR perhaps)
ce7fe7c
to
3086be6
Compare
497ad4f
to
7a91c7b
Compare
7a91c7b
to
794e080
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going to go ahead and land this
top-level Cargo.toml patches crates.io to point to the in-tree versions of several crates. Revert some of the changes introduced by the commit 98957ae ("x509-cert: add certificate builder (RustCrypto#764)") which gets overriden again by the patch.crates.io config. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
top-level Cargo.toml patches crates.io to point to the in-tree versions of several crates. Revert some of the changes introduced by the commit 98957ae ("x509-cert: add certificate builder (RustCrypto#764)") which gets overriden again by the patch.crates.io config. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Added - Certificate builder ([RustCrypto#764]) - Support for `RandomizedSigner` in builder ([RustCrypto#1007]) - Provide parsing profiles ([RustCrypto#987]) - Support for `Time::INFINITY` ([RustCrypto#1024]) - Conversion from `std::net::IpAddr` ([RustCrypto#1035]) - `CertReq` builder ([RustCrypto#1034]) Changed - use `ErrorKind::Value` for overlength serial ([RustCrypto#988]) - Bump `hex-literal` to v0.4.1 ([RustCrypto#999]) - Builder updates ([RustCrypto#1001]) - better debug info when `zlint` isn't installed ([RustCrypto#1018]) - make SKI optional in leaf certificate ([RustCrypto#1028]) - bump rsa from 0.9.0-pre.2 to 0.9.0 ([RustCrypto#1033]) Fixed - fix `KeyUsage` bit tests ([RustCrypto#993]) - extraneous PhantomData in `TbsCertificate` ([RustCrypto#1019])
Added - Certificate builder ([RustCrypto#764]) - Support for `RandomizedSigner` in builder ([RustCrypto#1007]) - Provide parsing profiles ([RustCrypto#987]) - Support for `Time::INFINITY` ([RustCrypto#1024]) - Conversion from `std::net::IpAddr` ([RustCrypto#1035]) - `CertReq` builder ([RustCrypto#1034]) Changed - use `ErrorKind::Value` for overlength serial ([RustCrypto#988]) - Bump `hex-literal` to v0.4.1 ([RustCrypto#999]) - Builder updates ([RustCrypto#1001]) - better debug info when `zlint` isn't installed ([RustCrypto#1018]) - make SKI optional in leaf certificate ([RustCrypto#1028]) - bump rsa from 0.9.0-pre.2 to 0.9.0 ([RustCrypto#1033]) Fixed - fix `KeyUsage` bit tests ([RustCrypto#993]) - extraneous PhantomData in `TbsCertificate` ([RustCrypto#1017])
Added - Certificate builder (RustCrypto#764) - Support for `RandomizedSigner` in builder (RustCrypto#1007) - Provide parsing profiles (RustCrypto#987) - Support for `Time::INFINITY` (RustCrypto#1024) - Conversion from `std::net::IpAddr` (RustCrypto#1035) - `CertReq` builder (RustCrypto#1034) - missing extension implementations (RustCrypto#1050) - notes about `UTCTime` range being 1970-2049 (RustCrypto#1052) Changed - use `ErrorKind::Value` for overlength serial (RustCrypto#988) - Bump `hex-literal` to v0.4.1 (RustCrypto#999) - Builder updates (RustCrypto#1001) - better debug info when `zlint` isn't installed (RustCrypto#1018) - make SKI optional in leaf certificate (RustCrypto#1028) - bump rsa from 0.9.0-pre.2 to 0.9.0 (RustCrypto#1033) - bump rsa from 0.9.1 to 0.9.2 (RustCrypto#1056) Fixed - fix `KeyUsage` bit tests (RustCrypto#993) - extraneous PhantomData in `TbsCertificate` (RustCrypto#1017) - CI flakiness (RustCrypto#1042) - usage of ecdsa signer (RustCrypto#1043)
Added - Certificate builder (RustCrypto#764) - Support for `RandomizedSigner` in builder (RustCrypto#1007) - Provide parsing profiles (RustCrypto#987) - Support for `Time::INFINITY` (RustCrypto#1024) - Conversion from `std::net::IpAddr` (RustCrypto#1035) - `CertReq` builder (RustCrypto#1034) - missing extension implementations (RustCrypto#1050) - notes about `UTCTime` range being 1970-2049 (RustCrypto#1052) - consume the `SignatureBitStringEncoding` trait (RustCrypto#1048) Changed - use `ErrorKind::Value` for overlength serial (RustCrypto#988) - Bump `hex-literal` to v0.4.1 (RustCrypto#999) - Builder updates (RustCrypto#1001) - better debug info when `zlint` isn't installed (RustCrypto#1018) - make SKI optional in leaf certificate (RustCrypto#1028) - bump rsa from 0.9.0-pre.2 to 0.9.0 (RustCrypto#1033) - bump rsa from 0.9.1 to 0.9.2 (RustCrypto#1056) Fixed - fix `KeyUsage` bit tests (RustCrypto#993) - extraneous PhantomData in `TbsCertificate` (RustCrypto#1017) - CI flakiness (RustCrypto#1042) - usage of ecdsa signer (RustCrypto#1043)
Added - Certificate builder (#764) - Support for `RandomizedSigner` in builder (#1007) - Provide parsing profiles (#987) - Support for `Time::INFINITY` (#1024) - Conversion from `std::net::IpAddr` (#1035) - `CertReq` builder (#1034) - missing extension implementations (#1050) - notes about `UTCTime` range being 1970-2049 (#1052) - consume the `SignatureBitStringEncoding` trait (#1048) Changed - use `ErrorKind::Value` for overlength serial (#988) - Bump `hex-literal` to v0.4.1 (#999) - Builder updates (#1001) - better debug info when `zlint` isn't installed (#1018) - make SKI optional in leaf certificate (#1028) - bump rsa from 0.9.0-pre.2 to 0.9.0 (#1033) - bump rsa from 0.9.1 to 0.9.2 (#1056) Fixed - fix `KeyUsage` bit tests (#993) - extraneous PhantomData in `TbsCertificate` (#1017) - CI flakiness (#1042) - usage of ecdsa signer (#1043)
This is an attempt at a certificate builder.
See: #418