summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@ifm.com>2022-07-22 10:18:02 +0200
committerMatthias Beyer <matthias.beyer@ifm.com>2022-07-22 10:25:51 +0200
commit10c22fdcd7bbcfc05e0e5788fc90b7b053d48f3a (patch)
tree03f918ed1f3a4f6eb0331cd5f356b01252fe095f
parent6c612f10e0045de3492d26e3d4134640e4a9656d (diff)
Fix usage of to_rfc2822()
Updating x509-parser in 6c612f10e0045de3492d26e3d4134640e4a9656d ("Bump x509-parser from 0.13.2 to 0.14.0") resulted in a changed interface of the `to_rfc2822()` function, meaning that the function now returns a `Result<_>`. We can map the error here to our type easily though. Signed-off-by: Matthias Beyer <matthias.beyer@ifm.com>
-rw-r--r--crates/common/certificate/src/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/common/certificate/src/lib.rs b/crates/common/certificate/src/lib.rs
index f7ce03f5..0c81a73d 100644
--- a/crates/common/certificate/src/lib.rs
+++ b/crates/common/certificate/src/lib.rs
@@ -49,12 +49,20 @@ impl PemCertificate {
pub fn not_before(&self) -> Result<String, CertificateError> {
let x509 = PemCertificate::extract_certificate(&self.pem)?;
- Ok(x509.tbs_certificate.validity.not_before.to_rfc2822())
+ x509.tbs_certificate
+ .validity
+ .not_before
+ .to_rfc2822()
+ .map_err(CertificateError::X509Error)
}
pub fn not_after(&self) -> Result<String, CertificateError> {
let x509 = PemCertificate::extract_certificate(&self.pem)?;
- Ok(x509.tbs_certificate.validity.not_after.to_rfc2822())
+ x509.tbs_certificate
+ .validity
+ .not_after
+ .to_rfc2822()
+ .map_err(CertificateError::X509Error)
}
pub fn thumbprint(&self) -> Result<String, CertificateError> {