/rust/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.23.20/src/server/common.rs
Line | Count | Source (jump to first uncovered line) |
1 | | use pki_types::CertificateDer; |
2 | | |
3 | | use crate::sign; |
4 | | |
5 | | /// ActiveCertifiedKey wraps [`sign::CertifiedKey`] and tracks OSCP state in a single handshake. |
6 | | pub(super) struct ActiveCertifiedKey<'a> { |
7 | | key: &'a sign::CertifiedKey, |
8 | | ocsp: Option<&'a [u8]>, |
9 | | } |
10 | | |
11 | | impl ActiveCertifiedKey<'_> { |
12 | 0 | pub(super) fn from_certified_key(key: &sign::CertifiedKey) -> ActiveCertifiedKey<'_> { |
13 | 0 | ActiveCertifiedKey { |
14 | 0 | key, |
15 | 0 | ocsp: key.ocsp.as_deref(), |
16 | 0 | } |
17 | 0 | } |
18 | | |
19 | | /// Get the certificate chain |
20 | | #[inline] |
21 | 0 | pub(super) fn get_cert(&self) -> &[CertificateDer<'static>] { |
22 | 0 | &self.key.cert |
23 | 0 | } |
24 | | |
25 | | /// Get the signing key |
26 | | #[inline] |
27 | 0 | pub(super) fn get_key(&self) -> &dyn sign::SigningKey { |
28 | 0 | &*self.key.key |
29 | 0 | } |
30 | | |
31 | | #[inline] |
32 | 0 | pub(super) fn get_ocsp(&self) -> Option<&[u8]> { |
33 | 0 | self.ocsp |
34 | 0 | } |
35 | | } |