RustCrypto / RustCrypto/formats

cms builders: how can I surface signing errors?

Open
#1,987 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
338
Forks
188
Avg merge
4d 6h
Merged PRs (30d)
15

Description

I'm not sure how I'm supposed to access the underlying error when it gets dropped on line 415:

https://github.com/RustCrypto/formats/blob/cfacd3efed49b28f38e69612221b8af5f33a5cbf/cms/src/builder.rs#L400-L419

For my use case, I'm signing remotely using Google KMS, and so there are numerous failure conditions (e.g. web request failed, couldn't deserialize response body, checksum didn't match), but any useful information I put into my errors in my Signer::try_sign impl get dropped by the map_err above

I understand the concerns about leaking secrets and hence the design of signature::Error - no issues there, but even if I'm wanting to provide useful secretless errors I can't because they get swallowed in internal library code

Thus I'd like to understand why the API was designed like this, and if potentially this could be changed in the future. Naturally this limitation can be worked around one way or another, but it's cumbersome to do so

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cms/src/builder.rs around lines 400-419, especially the map_err call that drops the Signer::try_sign error. Trace how signing errors are represented and determine what API behavior would preserve useful, secretless context without violating signature::Error's design. Done requires a concrete, reviewed approach for exposing or retaining those errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.