-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Directly support PEM decoding of pki-types
The `pem::PemObject` trait is the high-level entry point into this, and allows (eg) an iterator of `CertificateDer`s to be created from a filename (amongst other options). This caters to types that are typically plural (certificates, CRLs) and ones that are singular (keys) -- the later with APIs that select the first matching object or error if there are none. At a lower level, there are iterator-based APIs for consuming all the supported PEM sections in a file, stream or slice in one pass. Simple types who have a one-to-one mapping between PEM section (ie, `CertificateDer` is only ever from a PEM `BEGIN CERTIFICATE` section) impl `pem::PemObject` via `pem::PemObjectFilter` which minimises boilerplate. `PrivateKeyDer` is more complex, and impls `pem::PemObject` itself so it can dispatch the three source PEM section types (`PRIVATE KEY`, `RSA PRIVATE KEY`, & `EC PRIVATE KEY`) to the right enum variant.
- Loading branch information
Showing
2 changed files
with
371 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.