Skip to content

Add support for CoseHashEnvelope#125

Merged
JeromySt merged 12 commits intomainfrom
users/jstatia/support_COSE_Hash_Envelope
Mar 13, 2025
Merged

Add support for CoseHashEnvelope#125
JeromySt merged 12 commits intomainfrom
users/jstatia/support_COSE_Hash_Envelope

Conversation

@JeromySt
Copy link
Copy Markdown
Member

@JeromySt JeromySt commented Mar 8, 2025

Add CoseHashEnvelope support to signing library from https://datatracker.ietf.org/doc/draft-ietf-cose-hash-envelope/03/

This commit introduces a new signature version, CoseHashEnvelope, to replace the older CoseHashV format. Key changes include:

  • Updated CoseSign1MessageIndirectSignatureExtensionsTests and IndirectSignatureFactory to support the new format.
  • Refactored methods for creating indirect signatures to support CoseHashEnvelope.
  • Added new overload that allow specification for which message format for the factory to create
  • Updated existing method signatures to now use CoseHashEnvelope as the default format and CoseHashV is now the useOldFormat=true value.
  • Enhanced CoseSign1Message with methods to check for CoseHashEnvelope presence and retrieve associated hash algorithms and content types.

These changes improve the functionality and flexibility of the COSE signing library while ensuring backward compatibility for creation and validation.

Jstatia added 3 commits March 7, 2025 22:21
This commit introduces a new signature version, `CoseHashEnvelope`, to replace the older `CoseHashV` format. Key changes include:

- Updated `CoseSign1MessageIndirectSignatureExtensionsTests` and `IndirectSignatureFactory` to support the new format.
- Refactored methods for creating indirect signatures to align with `CoseHashEnvelope`.
- Removed obsolete methods from the `CoseHashV` class and replaced them with implementations for the new format.
- Enhanced `CoseSign1Message` with methods to check for `CoseHashEnvelope` presence and retrieve associated hash algorithms and content types.

These changes improve the functionality and flexibility of the COSE signing library while ensuring backward compatibility.
- Updated `System.Threading.Tasks.Extensions` to 4.6.0 in `CoseIndirectSignature.csproj`.
- Updated `System.Security.Cryptography.Cose` to 9.0.2 in `CoseSign1.Abstractions.csproj` and `CoseSign1.Tests.csproj`.
- Updated `System.Runtime.Caching` to 9.0.2 in `CoseSign1.Certificates.csproj`.
- Removed `System.Formats.Cbor` from `CoseSign1.Tests.csproj`.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Overview

This PR adds comprehensive support for the new CoseHashEnvelope signature format to the COSE signing library while maintaining backward compatibility with the legacy CoseHashV approach. Key changes include:

  • New extension methods and overloads to create, validate, and extract CoseHashEnvelope signatures.
  • Updates to the indirect signature factory to support both CoseHashEnvelope and CoseHashV formats.
  • Modifications to tests and documentation ensuring correct usage and error handling for the new envelope format.

Reviewed Changes

File Description
CoseIndirectSignature/Extensions/CoseSign1MessageCoseHashVExtensions.cs Added helper methods for CoseHashV signatures (unchanged in this PR).
CoseIndirectSignature/Extensions/CoseSign1MessageCoseHashEnvelopeExtensions.cs New extensions to support CoseHashEnvelope functionality.
CoseIndirectSignature/CoseHashEnvelopeHeaderExtender.cs Added header extender for CoseHashEnvelope and updated header handling.
IndirectSignatureFactory.* files Added and modified methods to create indirect signatures based on both CoseHashEnvelope and CoseHashV formats.
CoseIndirectSignature.Tests/* and CoseSignTool.Tests/* Updated tests to verify functionality for both the new and legacy formats.
README.md Minor documentation update regarding dependencies.

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

CoseIndirectSignature/CoseHashV.cs:138

  • [nitpick] The variable name 'hashAlgorightm' is misspelled; consider renaming it to 'hashAlgorithm' for clarity and consistency.
using HashAlgorithm hashAlgorightm = GetHashAlgorithmFromCoseHashAlgorithm(algorithm);

Comment thread CoseIndirectSignature/CoseHashEnvelopeHeaderExtender.cs
Comment thread CoseIndirectSignature/Extensions/CoseSign1MessageCoseHashVExtensions.cs Dismissed
Comment thread CoseIndirectSignature/Extensions/CoseSign1MessageCoseHashVExtensions.cs Dismissed
Comment thread CoseIndirectSignature.Tests/CoseHashEnvelopeTests.cs Dismissed
Comment thread CoseIndirectSignature.Tests/CoseHashEnvelopeTests.cs Dismissed
Comment thread CoseIndirectSignature.Tests/CoseHashEnvelopeTests.cs Dismissed
Comment thread CoseIndirectSignature.Tests/CoseHashEnvelopeTests.cs Dismissed
Comment thread CoseIndirectSignature.Tests/CoseHashEnvelopeTests.cs Fixed
@JeromySt JeromySt merged commit 9b59634 into main Mar 13, 2025
10 checks passed
@JeromySt JeromySt deleted the users/jstatia/support_COSE_Hash_Envelope branch March 13, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants