Skip to content

Commit 36680e8

Browse files
committed
Add documentation for removed APIs in System.Security.Cryptography.Pkcs netstandard2.0
1 parent 4ecc90e commit 36680e8

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

docs/core/compatibility/9.0.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ If you're migrating an app to .NET 9, the breaking changes listed here might aff
6161

6262
| Title | Type of change | Introduced version |
6363
|--------------------------------------------------------------------------------------------------------------|---------------------|--------------------|
64+
| [APIs Removed from System.Security.Cryptography.Pkcs netstandard2.0](cryptography/9.0/api-removed-pkcs.md) | Source incompatible | GA |
6465
| [SafeEvpPKeyHandle.DuplicateHandle up-refs the handle](cryptography/9.0/evp-pkey-handle.md) | Behavioral change | Preview 7 |
6566
| [Some X509Certificate2 and X509Certificate constructors are obsolete](cryptography/9.0/x509-certificates.md) | Source incompatible | Preview 7 |
6667
| [Windows private key lifetime simplified](cryptography/9.0/private-key-lifetime.md) | Behavioral change | Preview 7 |
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: "Breaking change - APIs Removed from System.Security.Cryptography.Pkcs netstandard2.0"
3+
description: "Learn about the breaking change in .NET 9 where certain APIs were removed from System.Security.Cryptography.Pkcs netstandard2.0."
4+
ms.date: 3/11/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/45186
7+
---
8+
9+
# APIs Removed from System.Security.Cryptography.Pkcs netstandard2.0
10+
11+
The `netstandard2.0` build of the `System.Security.Cryptography.Pkcs` NuGet package versions 9.0.0 through 9.0.2 included APIs that are not present in .NET Framework. Calling these APIs from a .NET Standard library that runs on .NET Framework will throw <xref:System.MissingMemberException>. These members were mistakenly included and have been removed in version 9.0.3 of the package.
12+
13+
## Version introduced
14+
15+
.NET 9
16+
17+
## Previous behavior
18+
19+
When referencing `System.Security.Cryptography.Pkcs` version 9.0.0 in a project targeting `netstandard2.0`, the compilation would succeed when referencing the <xref:System.Security.Cryptography.Pkcs.CmsSigner.PrivateKey?displayProperty=nameWithType> property. However, if the library ran on .NET Framework, accessing the property would trigger a <xref:System.MissingMemberException>.
20+
21+
## New behavior
22+
23+
Accessing any of the removed members now results in a compilation failure, rather than a runtime failure.
24+
25+
## Type of breaking change
26+
27+
This is a [source incompatible](../../categories.md#source-compatibility) change.
28+
29+
## Reason for change
30+
31+
The members were accidentally included due to a change in how the NuGet package was produced. As these members cannot work on .NET Framework, they should never have been listed as available to .NET Standard 2.0.
32+
33+
## Recommended action
34+
35+
If these additional members are needed, compile specifically for a TFM that includes them, such as `net8.0`.
36+
37+
## Affected APIs
38+
39+
- <xref:System.Security.Cryptography.Pkcs.CmsSigner.%23ctor*>
40+
- <xref:System.Security.Cryptography.Pkcs.CmsSigner.PrivateKey?displayProperty=fullName>
41+
- <xref:System.Security.Cryptography.Pkcs.CmsSigner.SignaturePadding?displayProperty=fullName>
42+
- <xref:System.Security.Cryptography.Pkcs.ContentInfo.GetContentType(System.ReadOnlySpan{System.Byte})?displayProperty=fullName>
43+
- <xref:System.Security.Cryptography.Pkcs.EnvelopedCms.Decode(System.ReadOnlySpan{System.Byte})?displayProperty=fullName>
44+
- <xref:System.Security.Cryptography.Pkcs.EnvelopedCms.Decrypt(System.Security.Cryptography.Pkcs.RecipientInfo,System.Security.Cryptography.AsymmetricAlgorithm)?displayProperty=fullName>
45+
- <xref:System.Security.Cryptography.Pkcs.SignedCms.AddCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2)?displayProperty=fullName>
46+
- <xref:System.Security.Cryptography.Pkcs.SignedCms.Decode(System.ReadOnlySpan{System.Byte})?displayProperty=fullName>
47+
- <xref:System.Security.Cryptography.Pkcs.SignedCms.RemoveCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2)?displayProperty=fullName>
48+
- <xref:System.Security.Cryptography.Pkcs.SignerInfo.AddUnsignedAttribute(System.Security.Cryptography.AsnEncodedData)?displayProperty=fullName>
49+
- <xref:System.Security.Cryptography.Pkcs.SignerInfo.SignatureAlgorithm?displayProperty=fullName>
50+
- <xref:System.Security.Cryptography.Pkcs.SignerInfo.GetSignature?displayProperty=fullName>
51+
- <xref:System.Security.Cryptography.Pkcs.SignerInfo.RemoveUnsignedAttribute(System.Security.Cryptography.AsnEncodedData)?displayProperty=fullName>
52+
- <xref:System.Security.Cryptography.Pkcs.SubjectIdentifier.MatchesCertificate(System.Security.Cryptography.X509Certificates.X509Certificate2)?displayProperty=fullName>

docs/core/compatibility/toc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ items:
116116
href: core-libraries/9.0/ziparchiveentry-encoding.md
117117
- name: Cryptography
118118
items:
119+
- name: APIs Removed from System.Security.Cryptography.Pkcs netstandard2.0
120+
href: cryptography/9.0/api-removed-pkcs.md
119121
- name: SafeEvpPKeyHandle.DuplicateHandle up-refs the handle
120122
href: cryptography/9.0/evp-pkey-handle.md
121123
- name: Some X509Certificate2 and X509Certificate constructors are obsolete
@@ -1616,6 +1618,8 @@ items:
16161618
href: cryptography/10.0/version-override.md
16171619
- name: .NET 9
16181620
items:
1621+
- name: APIs Removed from System.Security.Cryptography.Pkcs netstandard2.0
1622+
href: cryptography/9.0/api-removed-pkcs.md
16191623
- name: SafeEvpPKeyHandle.DuplicateHandle up-refs the handle
16201624
href: cryptography/9.0/evp-pkey-handle.md
16211625
- name: Some X509Certificate2 and X509Certificate constructors are obsolete

0 commit comments

Comments
 (0)