Skip to content

Commit b1771f2

Browse files
authored
Update DuplicateHandle remarks for .NET 9 (dotnet#10203)
1 parent 92a488b commit b1771f2

File tree

3 files changed

+105
-110
lines changed

3 files changed

+105
-110
lines changed

xml/System.Security.Cryptography/ECDsaOpenSsl.xml

Lines changed: 42 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@
4444
<Docs>
4545
<summary>Provides an implementation of the Elliptic Curve Digital Signature Algorithm (ECDSA) backed by OpenSSL.</summary>
4646
<remarks>
47-
<format type="text/markdown"><![CDATA[
48-
49-
## Remarks
50-
This class should only be used directly when doing platform interop with the system OpenSSL library.
51-
When platform interop is not needed, you should use the <xref:System.Security.Cryptography.ECDsa.Create%2A?displayProperty=nameWithType> factory methods instead of a specific derived implementation.
52-
47+
<format type="text/markdown"><![CDATA[
48+
49+
## Remarks
50+
This class should only be used directly when doing platform interop with the system OpenSSL library. When platform interop isn't needed, you should use the <xref:System.Security.Cryptography.ECDsa.Create%2A?displayProperty=nameWithType> factory methods instead of a specific derived implementation.
51+
5352
]]></format>
5453
</remarks>
5554
</Docs>
@@ -99,15 +98,14 @@ When platform interop is not needed, you should use the <xref:System.Security.Cr
9998
<Docs>
10099
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.ECDsaOpenSsl" /> class.</summary>
101100
<remarks>
102-
<format type="text/markdown"><![CDATA[
103-
104-
## Remarks
101+
<format type="text/markdown"><![CDATA[
102+
103+
## Remarks
105104
106105
This constructor does not generate a new public/private keypair immediately.
107-
This constructor sets the <xref:System.Security.Cryptography.ECDsaOpenSsl.KeySize> property to 521 and when a key is needed the saved size is used to identify the target curve.
108-
If a key is loaded via the <xref:System.Security.Cryptography.ECDsaOpenSsl.ImportParameters%2A> method, or other key import method, the key size from this constructor has no meaning.
109-
110-
106+
This constructor sets the <xref:System.Security.Cryptography.ECDsaOpenSsl.KeySize> property to 521 and when a key is needed, the saved size is used to identify the target curve.
107+
If a key is loaded via the <xref:System.Security.Cryptography.ECDsaOpenSsl.ImportParameters%2A> method or another key import method, the key size from this constructor has no meaning.
108+
111109
]]></format>
112110
</remarks>
113111
<altmember cref="M:System.Security.Cryptography.ECDsa.Create" />
@@ -162,15 +160,14 @@ If a key is loaded via the <xref:System.Security.Cryptography.ECDsaOpenSsl.Impor
162160
<param name="keySize">The size of the key. Valid key sizes are 256, 384, and 521 bits.</param>
163161
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.ECDsaOpenSsl" /> class with a specified target key size.</summary>
164162
<remarks>
165-
<format type="text/markdown"><![CDATA[
166-
167-
## Remarks
163+
<format type="text/markdown"><![CDATA[
164+
165+
## Remarks
168166
169167
This constructor does not generate a new public/private keypair immediately.
170-
This constructor sets the <xref:System.Security.Cryptography.ECDsaOpenSsl.KeySize> property to the provided value and when a key is needed the saved size is used to identify the target curve.
171-
If a key is loaded via the <xref:System.Security.Cryptography.ECDsaOpenSsl.ImportParameters%2A> method, or other key import method, the key size from this constructor has no meaning.
172-
173-
168+
This constructor sets the <xref:System.Security.Cryptography.ECDsaOpenSsl.KeySize> property to the provided value and when a key is needed, the saved size is used to identify the target curve.
169+
If a key is loaded via the <xref:System.Security.Cryptography.ECDsaOpenSsl.ImportParameters%2A> method or another key import method, the key size from this constructor has no meaning.
170+
174171
]]></format>
175172
</remarks>
176173
<exception cref="T:System.Security.Cryptography.CryptographicException">
@@ -227,12 +224,11 @@ If a key is loaded via the <xref:System.Security.Cryptography.ECDsaOpenSsl.Impor
227224
<param name="handle">The OpenSSL <c>EC_KEY*</c> value to use as the key.</param>
228225
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.ECDsaOpenSsl" /> class from an existing OpenSSL key represented as an <c>EC_KEY*</c>.</summary>
229226
<remarks>
230-
<format type="text/markdown"><![CDATA[
231-
232-
## Remarks
227+
<format type="text/markdown"><![CDATA[
228+
229+
## Remarks
233230
> [!IMPORTANT]
234-
> OpenSSL supports multiple library versions being loaded within the same process.
235-
> Before calling this constructor verify your pointer value came from the same version of OpenSSL that this class uses, see <xref:System.Security.Cryptography.SafeEvpPKeyHandle.OpenSslVersion> for more information.
231+
> OpenSSL supports multiple library versions being loaded within the same process. Before calling this constructor, verify that your pointer value came from the same version of OpenSSL that this class uses. For more information, see <xref:System.Security.Cryptography.SafeEvpPKeyHandle.OpenSslVersion>.
236232
237233
]]></format>
238234
</remarks>
@@ -348,13 +344,14 @@ If a key is loaded via the <xref:System.Security.Cryptography.ECDsaOpenSsl.Impor
348344
<param name="pkeyHandle">The OpenSSL <c>EVP_PKEY*</c> value to use as the key, represented as a <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" />.</param>
349345
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.ECDsaOpenSsl" /> class from an existing OpenSSL key represented as an <c>EVP_PKEY*</c>.</summary>
350346
<remarks>
351-
<format type="text/markdown"><![CDATA[
352-
353-
## Remarks
347+
<format type="text/markdown"><![CDATA[
348+
349+
## Remarks
350+
351+
In .NET 9 and later versions, external modifications of `pkeyHandle` also affect the handle stored in the instance that this constructor creates.
352+
354353
> [!IMPORTANT]
355-
> OpenSSL supports multiple library versions being loaded within the same process.
356-
> Before calling this constructor, verify your pointer value came from the same version of OpenSSL that this class uses.
357-
> For more information, see <xref:System.Security.Cryptography.SafeEvpPKeyHandle.OpenSslVersion>.
354+
> OpenSSL supports multiple library versions being loaded within the same process. Before calling this constructor, verify that your pointer value came from the same version of OpenSSL that this class uses. For more information, see <xref:System.Security.Cryptography.SafeEvpPKeyHandle.OpenSslVersion>.
358355
359356
]]></format>
360357
</remarks>
@@ -425,11 +422,10 @@ If a key is loaded via the <xref:System.Security.Cryptography.ECDsaOpenSsl.Impor
425422
<summary>Gets a <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.</summary>
426423
<returns>A <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.</returns>
427424
<remarks>
428-
<format type="text/markdown"><![CDATA[
429-
425+
<format type="text/markdown"><![CDATA[
426+
430427
## Remarks
431-
Each call to this method produces a new <xref:System.Security.Cryptography.SafeEvpPKeyHandle> object with its own lifetime.
432-
The objects returned by this method can safely be used even after this <xref:System.Security.Cryptography.ECDsaOpenSsl> instance has been disposed.
428+
Each call to this method produces a new <xref:System.Security.Cryptography.SafeEvpPKeyHandle> object with its own lifetime. The objects returned by this method can safely be used even after this <xref:System.Security.Cryptography.ECDsaOpenSsl> instance has been disposed. However, modifying operations (that is, direct calls to modifying OpenSSL APIs) on the new handle operate on the same underlying object. The new instance this method returns is simply an additional reference.
433429
434430
]]></format>
435431
</remarks>
@@ -623,11 +619,11 @@ The objects returned by this method can safely be used even after this <xref:Sys
623619
<param name="parameters">The curve parameters.</param>
624620
<summary>Replaces the current key for this instance with one using the specified key parameters.</summary>
625621
<remarks>
626-
<format type="text/markdown"><![CDATA[
627-
628-
## Remarks
629-
If `parameters` contains only <xref:System.Security.Cryptography.ECParameters.Q>, only a public key is imported. If `parameters` also contains <xref:System.Security.Cryptography.ECParameters.D>, a full key pair is imported. The <xref:System.Security.Cryptography.ECParameters.Curve> field specifies the type of the curve to import.
630-
622+
<format type="text/markdown"><![CDATA[
623+
624+
## Remarks
625+
If `parameters` contains only <xref:System.Security.Cryptography.ECParameters.Q>, only a public key is imported. If `parameters` also contains <xref:System.Security.Cryptography.ECParameters.D>, a full key pair is imported. The <xref:System.Security.Cryptography.ECParameters.Curve> field specifies the type of the curve to import.
626+
631627
]]></format>
632628
</remarks>
633629
<exception cref="T:System.Security.Cryptography.CryptographicException">
@@ -658,9 +654,9 @@ The objects returned by this method can safely be used even after this <xref:Sys
658654
<summary>Gets or sets the size, in bits, of the key modulus used by the asymmetric algorithm.</summary>
659655
<value>The size, in bits, of the key modulus used by the asymmetric algorithm.</value>
660656
<remarks>
661-
<format type="text/markdown"><![CDATA[
662-
663-
## Remarks
657+
<format type="text/markdown"><![CDATA[
658+
659+
## Remarks
664660
665661
Setting this property to its current value has no visible effect.
666662
Setting this property to a new legal value discards the current key, but defers creation of a new key until one is needed.
@@ -698,9 +694,9 @@ Because key sizes do not uniquely identify elliptic curves, the use of the prope
698694
<summary>Gets the key sizes, in bits, that are supported by the <see cref="P:System.Security.Cryptography.ECDsaCng.KeySize" /> property setter.</summary>
699695
<value>An array that contains the key sizes supported by the <see cref="P:System.Security.Cryptography.ECDsaCng.KeySize" /> property setter.</value>
700696
<remarks>
701-
<format type="text/markdown"><![CDATA[
702-
703-
## Remarks
697+
<format type="text/markdown"><![CDATA[
698+
699+
## Remarks
704700
705701
In Elliptic Curve Cryptography (ECC) the key size is not the only input into the key generation process,
706702
it is derived from the curve parameters for a specific elliptic curve.

xml/System.Security.Cryptography/RSAOpenSsl.xml

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444
<Docs>
4545
<summary>Provides an implementation of the RSA algorithm backed by OpenSSL.</summary>
4646
<remarks>
47-
<format type="text/markdown"><![CDATA[
48-
49-
## Remarks
47+
<format type="text/markdown"><![CDATA[
48+
49+
## Remarks
5050
> [!NOTE]
51-
> The <xref:System.Security.Cryptography.RSAOpenSsl> class is an implementation of the RSA algorithm using OpenSSL. It isn't available on Windows and is only available on other operating systems when OpenSSL is installed. For applications which aren't doing OpenSSL-specific interop, you're encouraged to use <xref:System.Security.Cryptography.RSA.Create%2A?displayProperty=nameWithType> instead of referencing this type directly.
52-
51+
> The <xref:System.Security.Cryptography.RSAOpenSsl> class is an implementation of the RSA algorithm using OpenSSL. It isn't available on Windows and is only available on other operating systems when OpenSSL is installed. For applications that aren't doing OpenSSL-specific interop, it's recommended to use <xref:System.Security.Cryptography.RSA.Create%2A?displayProperty=nameWithType> instead of referencing this type directly.
52+
5353
]]></format>
5454
</remarks>
5555
</Docs>
@@ -99,14 +99,14 @@
9999
<Docs>
100100
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOpenSsl" /> class with a random 2048-bit key pair.</summary>
101101
<remarks>
102-
<format type="text/markdown"><![CDATA[
103-
104-
## Remarks
102+
<format type="text/markdown"><![CDATA[
103+
104+
## Remarks
105105
106106
This constructor does not generate a new public/private keypair immediately.
107-
This constructor sets the <xref:System.Security.Cryptography.RSAOpenSsl.KeySize> property to 2048 and when a key is needed one is generated using the property value.
108-
If a key is loaded via the <xref:System.Security.Cryptography.RSAOpenSsl.ImportParameters%2A> method, or other key import method, the key size from this constructor has no meaning.
109-
107+
This constructor sets the <xref:System.Security.Cryptography.RSAOpenSsl.KeySize> property to 2048 and when a key is needed, one is generated using the property value.
108+
If a key is loaded via the <xref:System.Security.Cryptography.RSAOpenSsl.ImportParameters%2A> method or another key import method, the key size from this constructor has no meaning.
109+
110110
]]></format>
111111
</remarks>
112112
</Docs>
@@ -161,13 +161,13 @@ If a key is loaded via the <xref:System.Security.Cryptography.RSAOpenSsl.ImportP
161161
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOpenSsl" /> class with a randomly generated key of the specified size.</summary>
162162
<remarks>To be added.</remarks>
163163
<remarks>
164-
<format type="text/markdown"><![CDATA[
165-
166-
## Remarks
164+
<format type="text/markdown"><![CDATA[
165+
166+
## Remarks
167167
This constructor does not generate a new public/private keypair immediately.
168-
This constructor sets the <xref:System.Security.Cryptography.RSAOpenSsl.KeySize> property to `keySize` and when a key is needed one is generated using the property value.
169-
If a key is loaded via the <xref:System.Security.Cryptography.RSAOpenSsl.ImportParameters%2A> method, or other key import method, the key size from this constructor has no meaning.
170-
168+
This constructor sets the <xref:System.Security.Cryptography.RSAOpenSsl.KeySize> property to `keySize` and when a key is needed, one is generated using the property value.
169+
If a key is loaded via the <xref:System.Security.Cryptography.RSAOpenSsl.ImportParameters%2A> method or another key import method, the key size from this constructor has no meaning.
170+
171171
]]></format>
172172
</remarks>
173173
<exception cref="T:System.Security.Cryptography.CryptographicException">
@@ -223,14 +223,13 @@ If a key is loaded via the <xref:System.Security.Cryptography.RSAOpenSsl.ImportP
223223
<param name="handle">The OpenSSL <c>RSA*</c> value to use as the key.</param>
224224
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOpenSsl" /> class from an existing OpenSSL key represented as an <c>RSA*</c>.</summary>
225225
<remarks>
226-
<format type="text/markdown"><![CDATA[
227-
228-
## Remarks
226+
<format type="text/markdown"><![CDATA[
227+
228+
## Remarks
229229
230230
> [!IMPORTANT]
231231
> OpenSSL supports multiple library versions being loaded within the same process.
232-
> Before calling this constructor, verify your pointer value came from the same version of OpenSSL that this class uses.
233-
> For more information, see <xref:System.Security.Cryptography.SafeEvpPKeyHandle.OpenSslVersion>.
232+
> Before calling this constructor, verify that your pointer value came from the same version of OpenSSL that this class uses. For more information, see <xref:System.Security.Cryptography.SafeEvpPKeyHandle.OpenSslVersion>.
234233
235234
]]></format>
236235
</remarks>
@@ -289,9 +288,9 @@ If a key is loaded via the <xref:System.Security.Cryptography.RSAOpenSsl.ImportP
289288
<param name="parameters">The parameters for the key.</param>
290289
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOpenSsl" /> class using specified key parameters.</summary>
291290
<remarks>
292-
<format type="text/markdown"><![CDATA[
293-
294-
## Remarks
291+
<format type="text/markdown"><![CDATA[
292+
293+
## Remarks
295294
This constructor is equivalent to using the default constructor and calling <xref:System.Security.Cryptography.RSAOpenSsl.ImportParameters%2A>.
296295
297296
]]></format>
@@ -349,14 +348,15 @@ This constructor is equivalent to using the default constructor and calling <xre
349348
<param name="pkeyHandle">The OpenSSL <c>EVP_PKEY*</c> value to use as the key, represented as a <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" />.</param>
350349
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.RSAOpenSsl" /> class from an existing OpenSSL key represented as an <c>EVP_PKEY*</c>.</summary>
351350
<remarks>
352-
<format type="text/markdown"><![CDATA[
353-
354-
## Remarks
351+
<format type="text/markdown"><![CDATA[
352+
353+
## Remarks
354+
355+
In .NET 9 and later versions, external modifications of `pkeyHandle` also affect the handle stored in the instance that this constructor creates.
355356
356357
> [!IMPORTANT]
357358
> OpenSSL supports multiple library versions being loaded within the same process.
358-
> Before calling this constructor, verify your pointer value came from the same version of OpenSSL that this class uses.
359-
> For more information, see <xref:System.Security.Cryptography.SafeEvpPKeyHandle.OpenSslVersion>.
359+
> Before calling this constructor, verify that your pointer value came from the same version of OpenSSL that this class uses. For more information, see <xref:System.Security.Cryptography.SafeEvpPKeyHandle.OpenSslVersion>.
360360
361361
]]></format>
362362
</remarks>
@@ -409,7 +409,7 @@ The length of <paramref name="data" /> is not equal to the number of bytes for <
409409

410410
-or-
411411

412-
This instance represents only a public key.
412+
This instance represents only a public key.
413413

414414
-or-
415415

@@ -475,12 +475,11 @@ The decryption operation failed.</exception>
475475
<summary>Gets a <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.</summary>
476476
<returns>A <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.</returns>
477477
<remarks>
478-
<format type="text/markdown"><![CDATA[
479-
480-
## Remarks
478+
<format type="text/markdown"><![CDATA[
479+
480+
## Remarks
481481
482-
Each call to this method produces a new <xref:System.Security.Cryptography.SafeEvpPKeyHandle> object with its own lifetime.
483-
The objects returned by this method can safely be used even after this <xref:System.Security.Cryptography.RSAOpenSsl> instance has been disposed.
482+
Each call to this method produces a new <xref:System.Security.Cryptography.SafeEvpPKeyHandle> object with its own lifetime. The objects returned by this method can safely be used even after this <xref:System.Security.Cryptography.RSAOpenSsl> instance has been disposed. However, modifying operations (that is, direct calls to modifying OpenSSL APIs) on the new handle operate on the same underlying object. The new instance this method returns is simply an additional reference.
484483
485484
]]></format>
486485
</remarks>
@@ -692,9 +691,9 @@ The encryption operation failed.</exception>
692691
<summary>Gets or sets the size, in bits, of the key modulus used by the asymmetric algorithm.</summary>
693692
<value>The size, in bits, of the key modulus used by the asymmetric algorithm.</value>
694693
<remarks>
695-
<format type="text/markdown"><![CDATA[
696-
697-
## Remarks
694+
<format type="text/markdown"><![CDATA[
695+
696+
## Remarks
698697
699698
Setting this property to its current value has no visible effect.
700699
Setting this property to a new legal value discards the current key, but defers creation of a new key until one is needed.

0 commit comments

Comments
 (0)