diff options
author | Didier Wenzek <didier.wenzek@acidalie.com> | 2022-07-22 15:44:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-22 15:44:38 +0200 |
commit | 5f51334c09bd488ff07a42a08a9e3788eb0bdb8d (patch) | |
tree | 5e3f3326cb7d6d5d89c0bada9e4ced49aed9dd6f | |
parent | 8fa35179dfc8ded124c3295b913a468ffb4f6588 (diff) | |
parent | 10c22fdcd7bbcfc05e0e5788fc90b7b053d48f3a (diff) |
Merge pull request #1284 from matthiasbeyer/update-x509-parser
Update x509 parser
-rw-r--r-- | Cargo.lock | 20 | ||||
-rw-r--r-- | crates/common/certificate/Cargo.toml | 2 | ||||
-rw-r--r-- | crates/common/certificate/src/lib.rs | 12 |
3 files changed, 21 insertions, 13 deletions
@@ -85,9 +85,9 @@ checksum = "47253b98986dafc7a3e1cf3259194f1f47ac61abb57a57f46ec09e48d004ecda" [[package]] name = "asn1-rs" -version = "0.3.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" +checksum = "cf6690c370453db30743b373a60ba498fc0d6d83b11f4abfd87a84a075db5dd4" dependencies = [ "asn1-rs-derive", "asn1-rs-impl", @@ -101,9 +101,9 @@ dependencies = [ [[package]] name = "asn1-rs-derive" -version = "0.1.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ "proc-macro2 1.0.40", "quote 1.0.20", @@ -773,9 +773,9 @@ checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" [[package]] name = "der-parser" -version = "7.0.0" +version = "8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" +checksum = "42d4bc9b0db0a0df9ae64634ac5bdefb7afcb534e182275ca0beadbe486701c1" dependencies = [ "asn1-rs", "displaydoc", @@ -1854,9 +1854,9 @@ dependencies = [ [[package]] name = "oid-registry" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" +checksum = "7d4bda43fd1b844cbc6e6e54b5444e2b1bc7838bce59ad205902cccbb26d6761" dependencies = [ "asn1-rs", ] @@ -3808,9 +3808,9 @@ dependencies = [ [[package]] name = "x509-parser" -version = "0.13.2" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" +checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" dependencies = [ "asn1-rs", "base64", diff --git a/crates/common/certificate/Cargo.toml b/crates/common/certificate/Cargo.toml index 4e9cb7af..bf6299b3 100644 --- a/crates/common/certificate/Cargo.toml +++ b/crates/common/certificate/Cargo.toml @@ -12,7 +12,7 @@ rcgen = { version = "0.9", features = ["pem", "zeroize"] } sha-1 = "0.10" thiserror = "1.0" time = "0.3" -x509-parser = "0.13" +x509-parser = "0.14" zeroize = "1.5" [dev-dependencies] 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> { |