Skip to content

Commit 31e917b

Browse files
committed
Add context to failable DAC operations.
1 parent 7a95eb3 commit 31e917b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/ca.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,8 @@ impl Ca {
595595

596596
// Get public key from the cert of the Ca signing the Dcsr (self).
597597
let cert = self.cert()?;
598-
let signer_public_key = lpc55_sign::cert::public_key(&cert)?;
598+
let signer_public_key = lpc55_sign::cert::public_key(&cert)
599+
.context("Extracting RSA public key from DAC CA cert")?;
599600

600601
// lpc55_sign ergonomics
601602
let debug_public_key = spec.dcsr.debug_public_key.clone();
@@ -604,10 +605,13 @@ impl Ca {
604605
certs,
605606
signer_public_key,
606607
spec.dcsr,
607-
)?;
608+
)
609+
.context("Generating DAC TBS block")?;
608610

609611
// Sign it using the private key stored in the HSM.
610-
let dc_sig = client.sign_rsa_pkcs1v15_sha256(self.spec.id, &dc_tbs)?;
612+
let dc_sig = client
613+
.sign_rsa_pkcs1v15_sha256(self.spec.id, &dc_tbs)
614+
.context("Signing DAC TBS block")?;
611615

612616
// Append the signature to the TBS debug credential to make a complete debug
613617
// credential

0 commit comments

Comments
 (0)