pub struct CertificateDer(/* private fields */);Expand description
An X.509 certificate in DER form.
Implementations§
Source§impl CertificateDer
impl CertificateDer
Sourcepub fn new(der: Vec<u8>) -> Result<Self, BackendError>
pub fn new(der: Vec<u8>) -> Result<Self, BackendError>
Wrap certificate DER bytes after checking they parse.
§Errors
Returns BackendError::InvalidKeyFormat when the bytes are not an
X.509 certificate.
Sourcepub fn from_key_material(bytes: &[u8]) -> Result<Self, BackendError>
pub fn from_key_material(bytes: &[u8]) -> Result<Self, BackendError>
Read a certificate out of whatever a ceremony hands over.
Accepts certificate DER and certificate PEM. Certificates reach a ceremony from files and counterparties, where PEM is the common encoding, so the sniff belongs here rather than at each call site.
The counterpart to PublicKeyDer::from_key_material. Both exist so
that deciding what an encoding is happens in one place per type.
§Errors
Returns BackendError::InvalidKeyFormat when the bytes are neither,
or when a PEM block names something other than a certificate.
Sourcepub fn public_key(&self) -> Result<PublicKeyDer, BackendError>
pub fn public_key(&self) -> Result<PublicKeyDer, BackendError>
The subject public key, as SPKI DER.
A signer’s public key usually reaches a ceremony inside a certificate
rather than on its own: piv_read_certificate pulls one off a card, and
a counterparty sends one. This lets a step name the certificate instead
of the author extracting the key first.
§Errors
Returns BackendError::InvalidKeyFormat when the certificate or its
subject public key cannot be re-encoded.
Trait Implementations§
Source§impl Clone for CertificateDer
impl Clone for CertificateDer
Source§fn clone(&self) -> CertificateDer
fn clone(&self) -> CertificateDer
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more