fluvio_future/openssl/
certificate.rs1use anyhow::Result;
2use openssl::pkey::{PKey, Private};
3use openssl::x509::X509;
4
5#[derive(Debug)]
6pub struct Certificate(pub X509);
7
8impl Certificate {
9 pub fn from_pem(bytes: &[u8]) -> Result<Self> {
10 Ok(Self(X509::from_pem(bytes)?))
11 }
12 pub fn from_der(bytes: &[u8]) -> Result<Self> {
13 Ok(Self(X509::from_der(bytes)?))
14 }
15 pub fn to_der(&self) -> Result<Vec<u8>> {
16 Ok(self.0.to_der()?)
17 }
18
19 pub fn inner(&self) -> &X509 {
20 &self.0
21 }
22}
23pub struct PrivateKey(pub PKey<Private>);