microsoft / microsoft/CoseSignTool

CoseSign1.Certificates improperly pins the signing hash algorithm to SHA-256

Open
#213 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
54
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Summary

CertificateCoseSigningKeyProvider hard-codes the hash algorithm to SHA-256:

public HashAlgorithmName HashAlgorithm { get; } = HashAlgorithmName.SHA256;

Source: CoseSign1.Certificates/CertificateCoseSigningKeyProvider.cs at line 16

Problem

The signing hash algorithm is improperly pinned in the certificate-backed COSE signing key provider. Consumers cannot select or derive an appropriate hash algorithm when their certificate, signing policy, or COSE algorithm requires something other than SHA-256. This can cause incompatible signatures or prevent supported algorithms from being used.

Expected behavior

The provider should not unconditionally pin the hash algorithm to SHA-256. The algorithm should be configurable or determined from the selected COSE/signature algorithm and validated against the certificate and key capabilities.

Suggested direction

  • Allow callers to provide the hash algorithm, or derive it from the requested COSE algorithm.
  • Validate that the selected hash algorithm is compatible with the certificate and signing key.
  • Add tests covering algorithms other than SHA-256 and rejecting unsupported combinations.

Additional context

Repository: microsoft/CoseSignTool

Commit reviewed: 06ad9848429e845876db4550c9131e390e2a32bd

Contributor guide

Open the contributing guide

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 CoseSign1.Certificates/CertificateCoseSigningKeyProvider.cs at the HashAlgorithm property, then trace how the provider is selected and how the requested COSE/signature algorithm reaches it. Add coverage for a non-SHA-256 algorithm and unsupported certificate/key combinations; done means the hash is configurable or derived appropriately and compatibility is validated.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cryptography, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.