Skip to content

Commit 17f17a8

Browse files
authored
fix(cli): do not panic if private key password is wrong, closes #3449 (#3495)
1 parent 53e4dd8 commit 17f17a8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"cli.rs": patch
3+
"cli.js": patch
4+
---
5+
6+
Do not panic if the updater private key password is wrong.

tooling/cli/src/helpers/updater_signature.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5+
use anyhow::Context;
56
use base64::{decode, encode};
67
use minisign::{sign, KeyPair as KP, SecretKeyBox};
78
use std::{
@@ -109,8 +110,11 @@ where
109110
P: AsRef<Path>,
110111
{
111112
let decoded_secret = decode_key(private_key)?;
112-
let sk_box = SecretKeyBox::from_string(&decoded_secret).unwrap();
113-
let sk = sk_box.into_secret_key(password).unwrap();
113+
let sk_box = SecretKeyBox::from_string(&decoded_secret)
114+
.with_context(|| "failed to load updater private key")?;
115+
let sk = sk_box
116+
.into_secret_key(password)
117+
.with_context(|| "incorrect updater private key password")?;
114118

115119
// We need to append .sig at the end it's where the signature will be stored
116120
let signature_path_string = format!("{}.sig", bin_path.as_ref().display());

0 commit comments

Comments
 (0)