1 use crate::{key, sign}; 2 3 /// ActiveCertifiedKey wraps CertifiedKey and tracks OSCP and SCT state 4 /// in a single handshake. 5 pub(super) struct ActiveCertifiedKey<'a> { 6 key: &'a sign::CertifiedKey, 7 ocsp: Option<&'a [u8]>, 8 sct_list: Option<&'a [u8]>, 9 } 10 11 impl<'a> ActiveCertifiedKey<'a> { 12 pub(super) fn from_certified_key(key: &sign::CertifiedKey) -> ActiveCertifiedKey { 13 ActiveCertifiedKey { 14 key, 15 ocsp: key.ocsp.as_deref(), 16 sct_list: key.sct_list.as_deref(), 17 } 18 } 19 20 /// Get the certificate chain 21 #[inline] 22 pub(super) fn get_cert(&self) -> &[key::Certificate] { 23 &self.key.cert 24 } 25 26 /// Get the signing key 27 #[inline] 28 pub(super) fn get_key(&self) -> &dyn sign::SigningKey { 29 &*self.key.key 30 } 31 32 #[inline] 33 pub(super) fn get_ocsp(&self) -> Option<&[u8]> { 34 self.ocsp 35 } 36 37 #[inline] 38 pub(super) fn get_sct_list(&self) -> Option<&[u8]> { 39 self.sct_list 40 } 41 } 42