dotnet / dotnet/runtime

SignedCms: Match SignerInfo content-type to SignedData.encapContentInfo.eContentType

Open
#132,242 1 comment 0 reactions 0 assignees View on GitHub
area-System.Security
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

From https://datatracker.ietf.org/doc/html/rfc5652#section-5.6 (5.6. Signature Verification Process)

```
If the SignedData signerInfo includes signedAttributes, then the
content-type attribute value MUST match the SignedData
encapContentInfo eContentType value.
```

So, this is an RFC MUST that isn't being followed. Historically, we didn't verify it (explicitly... because of .NET Framework compat), but we've received complaints that we're missing this check, so we should add it.

https://github.com/dotnet/runtime/blob/cdc5b6220b7ad6a0fce09fed36aa6d6275f629ce/src/libraries/System.Security.Cryptography.Pkcs/src/System/Security/Cryptography/Pkcs/SignerInfo.cs#L634

Contributor guide

Open the contributing guide

Research direction

Start at SignerInfo.cs around line 634 and compare the existing SignedCms verification flow with RFC 5652 section 5.6. Trace how signedAttributes content-type and encapContentInfo eContentType are available, then verify that mismatched values are rejected while preserving the stated .NET Framework compatibility context.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cryptography, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.