-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RSDK-9433] - Store TLS certs in DER format to save space #360
base: main
Are you sure you want to change the base?
[RSDK-9433] - Store TLS certs in DER format to save space #360
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM it it's been verified on hardware.
Not sure if possible but would be cool if we can see how much space we've saved
use rustls_pki_types::pem::PemObject; | ||
use rustls_pki_types::{CertificateDer, PrivateKeyDer}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: join these
let _ = self.srv_cert.replace(srv_cert); | ||
let _ = self.srv_key.replace(srv_key); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice
&self.srv_cert.as_ref().unwrap(), | ||
&self.srv_key.as_ref().unwrap(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: ?
instead of unwrap since the return signature is compatible
let priv_keys = rustls::PrivateKey(self.srv_key.clone().unwrap()); | ||
let cert_chain = vec![rustls::Certificate(self.srv_cert.clone().unwrap())]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here with unwraps
fn try_from(resp: CertificateResponse) -> Result<Self, Self::Error> { | ||
// we convert the certificate and private key from PEM to DER format to save space | ||
let private_key_bytes = resp.tls_private_key.into_bytes(); | ||
let private_key = PrivateKeyDer::from_pem_slice(&private_key_bytes[0..])?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this range should just work with [..]
right? also, maybe check if the range is needed or if as_slice
is available.
L102 does the same
No description provided.