From a0efc6be4c961cc614af1c2a11baa6fbce6c0f53 Mon Sep 17 00:00:00 2001 From: BRA1L0R <17928339+BRA1L0R@users.noreply.github.com> Date: Thu, 13 Nov 2025 21:44:07 +0100 Subject: [PATCH 1/2] Implement from and into x509_cert::Certificate for Certificate type when using cert_nossl --- .gitignore | 3 ++- src/certs/snp/cert_nossl.rs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5f9ff5d6..c03e55e7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target -.vscode/ \ No newline at end of file +.vscode/ +.zed/ diff --git a/src/certs/snp/cert_nossl.rs b/src/certs/snp/cert_nossl.rs index 88aeb1a4..8a7cb35c 100644 --- a/src/certs/snp/cert_nossl.rs +++ b/src/certs/snp/cert_nossl.rs @@ -62,6 +62,11 @@ impl Verifiable for (&Certificate, &Certificate) { } impl Certificate { + /// Gets a reference to the X509 certificate inside + pub fn cert(&self) -> &x509_cert::Certificate { + &self.0 + } + /// Create a Certificate from a PEM-encoded X509 structure. pub fn from_pem(pem: &[u8]) -> Result { let cert = x509_cert::Certificate::from_pem(pem) @@ -106,3 +111,15 @@ impl Certificate { fn io_error_other>(error: S) -> io::Error { io::Error::new(ErrorKind::Other, error.into()) } + +impl From for Certificate { + fn from(value: x509_cert::Certificate) -> Self { + Self(value) + } +} + +impl From for x509_cert::Certificate { + fn from(Certificate(cert): Certificate) -> Self { + cert + } +} From 5d10b112792cb486421b6dbdab536f3b6375cb77 Mon Sep 17 00:00:00 2001 From: Pietro T <17928339+BRA1L0R@users.noreply.github.com> Date: Fri, 30 Jan 2026 10:43:03 +0000 Subject: [PATCH 2/2] remove unnecessary cert method exposing internal functionality --- src/certs/snp/cert_nossl.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/certs/snp/cert_nossl.rs b/src/certs/snp/cert_nossl.rs index 8a7cb35c..2be63b31 100644 --- a/src/certs/snp/cert_nossl.rs +++ b/src/certs/snp/cert_nossl.rs @@ -62,11 +62,6 @@ impl Verifiable for (&Certificate, &Certificate) { } impl Certificate { - /// Gets a reference to the X509 certificate inside - pub fn cert(&self) -> &x509_cert::Certificate { - &self.0 - } - /// Create a Certificate from a PEM-encoded X509 structure. pub fn from_pem(pem: &[u8]) -> Result { let cert = x509_cert::Certificate::from_pem(pem)