-
Notifications
You must be signed in to change notification settings - Fork 29
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 const
-friendly CertificateDer::from_slice
#51
Conversation
The main question in my mind is whether this should take |
That's a fair point. Given "Der" is in the outer type name already I would be in favour of changing it to take a slice directly. I'll adjust. |
const
-friendly CertificateDer::from_der
const
-friendly CertificateDer::from_slice
Done |
This commit adds the ability to construct a `const CertificateDer` by way of the `const`-friendly `CertificateDer::from_slice()` fn that accepts a slice of `&[u8]` DER.
I updated rustls/webpki-roots#75 to use the new |
|
In
webpki-roots
we want to be able to codegen constantCertificateDer
entries to support the use-case where trusted CA roots in full self-signed certificate form (as opposed to the minimalwebpki
TrustAnchor
representation) are required, for example when working with a platform verifier that consumes x509 trust anchors (See rustls/webpki-roots#75).While there is a
const
friendly way to createpki_types::Der
withDer::from_slice()
there's presently noconst
friendly way to create aCertificateDer
in a similar manner. This branch addsconst CertificateDer::from_slice()
for this purpose. We skip requiring theDer::from_slice()
and accept a&[u8]
directly since theCertificateDer
name already emphasizes the expected format and there's limited value in making callers jump through the extraDer::from_slice()
hoop.There are other types that wrap
Der<'_>
(e.g. thePrivateKeyDer
variants,CertificateRevocationListDer
, etc) but for now I've omitted adding similarfrom_slice()
const constructors for these types until there's a concrete need in-hand.