Skip to content
Snippets Groups Projects
Commit ed6f4080 authored by Jean-Michel Picod's avatar Jean-Michel Picod
Browse files

Address comments on pull-request

parent 5d938337
No related branches found
No related tags found
No related merge requests found
......@@ -52,12 +52,6 @@ fn main() {
let priv_key_vec = pkey.private_key().to_vec();
let key_len = priv_key_vec.len();
assert!(
key_len >= 30,
"Invalid private key (too small): {} ({:#?})",
priv_key_hex,
priv_key_vec,
);
assert!(
key_len <= 33,
"Invalid private key (too big): {} ({:#?})",
......@@ -68,8 +62,7 @@ fn main() {
// Copy OpenSSL generated key to our vec, starting from the end
let mut output_vec = [0u8; 32];
let min_key_len = std::cmp::min(key_len, 32);
output_vec[32usize.saturating_sub(min_key_len)..]
.copy_from_slice(&priv_key_vec[key_len.saturating_sub(min_key_len)..]);
output_vec[32 - min_key_len..].copy_from_slice(&priv_key_vec[key_len - min_key_len..]);
// Create the raw private key out of the OpenSSL data
let mut priv_key_bin_file = File::create(&priv_key_bin_path).unwrap();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment