Skip to content

Commit dc28756

Browse files
authored
API updates for .NET 6 breaking changes (#7262)
1 parent 27c1bd2 commit dc28756

File tree

3 files changed

+162
-155
lines changed

3 files changed

+162
-155
lines changed

xml/System.Security.Cryptography/AesCng.xml

Lines changed: 74 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@
108108
<param name="keyName">The name of the key.</param>
109109
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AesCng" /> class with the specified key name, which represents an existing persisted AES key.</summary>
110110
<remarks>
111-
<format type="text/markdown"><![CDATA[
112-
113-
## Remarks
114-
This constructor uses a default <xref:System.Security.Cryptography.CngKeyOpenOptions> value of <xref:System.Security.Cryptography.CngKeyOpenOptions.None> and <xref:System.Security.Cryptography.CngProvider.MicrosoftSoftwareKeyStorageProvider%2A> as the default key storage provider (KSP) to open the key.
115-
111+
<format type="text/markdown"><![CDATA[
112+
113+
## Remarks
114+
This constructor uses a default <xref:System.Security.Cryptography.CngKeyOpenOptions> value of <xref:System.Security.Cryptography.CngKeyOpenOptions.None> and <xref:System.Security.Cryptography.CngProvider.MicrosoftSoftwareKeyStorageProvider%2A> as the default key storage provider (KSP) to open the key.
115+
116116
]]></format>
117117
</remarks>
118118
<exception cref="T:System.ArgumentNullException">
@@ -158,18 +158,18 @@
158158
<param name="provider">The KSP that contains the key.</param>
159159
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AesCng" /> class with the specified key name, which represents an existing persisted AES key, and the specified key storage provider (KSP).</summary>
160160
<remarks>
161-
<format type="text/markdown"><![CDATA[
162-
163-
## Remarks
164-
A default <xref:System.Security.Cryptography.CngKeyOpenOptions> value of <xref:System.Security.Cryptography.CngKeyOpenOptions.None> is used to open the key.
165-
161+
<format type="text/markdown"><![CDATA[
162+
163+
## Remarks
164+
A default <xref:System.Security.Cryptography.CngKeyOpenOptions> value of <xref:System.Security.Cryptography.CngKeyOpenOptions.None> is used to open the key.
165+
166166
]]></format>
167167
</remarks>
168168
<exception cref="T:System.ArgumentNullException">
169-
<paramref name="keyName" /> is <see langword="null" />.
170-
171-
-or-
172-
169+
<paramref name="keyName" /> is <see langword="null" />.
170+
171+
-or-
172+
173173
<paramref name="provider" /> is <see langword="null" />.</exception>
174174
<exception cref="T:System.PlatformNotSupportedException">Cryptography Next Generation (CNG) is not supported on this system.</exception>
175175
<exception cref="T:System.Security.Cryptography.CryptographicException">All other errors.</exception>
@@ -215,10 +215,10 @@
215215
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AesCng" /> class with the specified key name, which represents an existing persisted AES key, the specified key storage provider (KSP) and key open options.</summary>
216216
<remarks>To be added.</remarks>
217217
<exception cref="T:System.ArgumentNullException">
218-
<paramref name="keyName" /> is <see langword="null" />.
219-
220-
-or-
221-
218+
<paramref name="keyName" /> is <see langword="null" />.
219+
220+
-or-
221+
222222
<paramref name="provider" /> is <see langword="null" />.</exception>
223223
<exception cref="T:System.PlatformNotSupportedException">Cryptography Next Generation (CNG) is not supported on this system.</exception>
224224
<exception cref="T:System.Security.Cryptography.CryptographicException">All other errors.</exception>
@@ -269,13 +269,15 @@
269269
<summary>Creates a symmetric AES decryptor object with the current key and initialization vector (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.IV" />).</summary>
270270
<returns>A symmetric AES decryptor object.</returns>
271271
<remarks>
272-
<format type="text/markdown"><![CDATA[
273-
274-
## Remarks
275-
This method decrypts an encrypted message created using the <xref:System.Security.Cryptography.AesCng.CreateEncryptor> overload with the same signature.
276-
272+
<format type="text/markdown"><![CDATA[
273+
274+
## Remarks
275+
276+
This method decrypts an encrypted message created using the <xref:System.Security.Cryptography.AesCng.CreateEncryptor> overload with the same signature.
277+
277278
]]></format>
278279
</remarks>
280+
<exception cref="T:System.Security.Cryptography.CryptographicException">.NET 6 and later: CFB128 mode is selected and the key is persisted.</exception>
279281
</Docs>
280282
</Member>
281283
<Member MemberName="CreateDecryptor">
@@ -319,29 +321,29 @@
319321
<summary>Creates a symmetric AES decryptor object with the specified key and initialization vector (IV).</summary>
320322
<returns>A symmetric AES decryptor object.</returns>
321323
<remarks>
322-
<format type="text/markdown"><![CDATA[
323-
324-
## Remarks
325-
This method decrypts an encrypted message created using the <xref:System.Security.Cryptography.AesCng.CreateEncryptor%28System.Byte%5B%5D%2CSystem.Byte%5B%5D%29> overload with the same signature.
326-
324+
<format type="text/markdown"><![CDATA[
325+
326+
## Remarks
327+
This method decrypts an encrypted message created using the <xref:System.Security.Cryptography.AesCng.CreateEncryptor%28System.Byte%5B%5D%2CSystem.Byte%5B%5D%29> overload with the same signature.
328+
327329
> [!NOTE]
328-
> If you've created the <xref:System.Security.Cryptography.AesCng> object using an existing persisted key and you want to make use of that key when decrypting the message, you want to set the <xref:System.Security.Cryptography.SymmetricAlgorithm.IV%2A> property and then call the parameterless <xref:System.Security.Cryptography.AesCng.CreateDecryptor> overload instead; otherwise, using this method will create an ephemeral key as specified by the `rgbKey` parameter.
329-
330+
> If you've created the <xref:System.Security.Cryptography.AesCng> object using an existing persisted key and you want to make use of that key when decrypting the message, you want to set the <xref:System.Security.Cryptography.SymmetricAlgorithm.IV%2A> property and then call the parameterless <xref:System.Security.Cryptography.AesCng.CreateDecryptor> overload instead; otherwise, using this method will create an ephemeral key as specified by the `rgbKey` parameter.
331+
330332
]]></format>
331333
</remarks>
332334
<exception cref="T:System.ArgumentNullException">
333335
<paramref name="rgbKey" /> is <see langword="null" />.</exception>
334336
<exception cref="T:System.ArgumentException">
335-
<paramref name="rgbKey" /> is not a valid size for this algorithm.
336-
337-
-or-
338-
337+
<paramref name="rgbKey" /> is not a valid size for this algorithm.
338+
339+
-or-
340+
339341
<paramref name="rgbIV" /> size does not match the block size for this algorithm.</exception>
340342
<exception cref="T:System.Security.Cryptography.CryptographicException">
341-
<paramref name="rgbKey" /> is a known weak key for this algorithm and cannot be used.
342-
343-
-or-
344-
343+
<paramref name="rgbKey" /> is a known weak key for this algorithm and cannot be used.
344+
345+
-or-
346+
345347
<paramref name="rgbIV" /> is <see langword="null" />.</exception>
346348
</Docs>
347349
</Member>
@@ -389,13 +391,15 @@
389391
<summary>Creates a symmetric AES encryptor object using the current key and initialization vector (<see cref="P:System.Security.Cryptography.SymmetricAlgorithm.IV" />).</summary>
390392
<returns>A symmetric AES encryptor object.</returns>
391393
<remarks>
392-
<format type="text/markdown"><![CDATA[
393-
394-
## Remarks
395-
Use this method to encrypt a message and then use the <xref:System.Security.Cryptography.AesCng.CreateDecryptor%2A> overload with the same signature to decrypt the result of this method.
396-
394+
<format type="text/markdown"><![CDATA[
395+
396+
## Remarks
397+
398+
Use this method to encrypt a message and then use the <xref:System.Security.Cryptography.AesCng.CreateDecryptor%2A> overload with the same signature to decrypt the result of this method.
399+
397400
]]></format>
398401
</remarks>
402+
<exception cref="T:System.Security.Cryptography.CryptographicException">.NET 6 and later: CFB128 mode is selected and the key is persisted.</exception>
399403
</Docs>
400404
</Member>
401405
<Member MemberName="CreateEncryptor">
@@ -439,29 +443,29 @@
439443
<summary>Creates a symmetric AES encryptor object with the specified key and initialization vector (IV).</summary>
440444
<returns>A symmetric AES encryptor object.</returns>
441445
<remarks>
442-
<format type="text/markdown"><![CDATA[
443-
444-
## Remarks
445-
Use this method to encrypt a message and then use the <xref:System.Security.Cryptography.AesCng.CreateDecryptor%2A> overload with the same signature to decrypt the result of this method.
446-
446+
<format type="text/markdown"><![CDATA[
447+
448+
## Remarks
449+
Use this method to encrypt a message and then use the <xref:System.Security.Cryptography.AesCng.CreateDecryptor%2A> overload with the same signature to decrypt the result of this method.
450+
447451
> [!NOTE]
448-
> If you've created the <xref:System.Security.Cryptography.AesCng> object using an existing persisted key and you want to make use of that key when encrypting the message, you want to set the <xref:System.Security.Cryptography.SymmetricAlgorithm.IV%2A> property and then call the parameterless <xref:System.Security.Cryptography.AesCng.CreateEncryptor> overload instead; otherwise, using this method will create an ephemeral key as specified by the `rgbKey` parameter.
449-
452+
> If you've created the <xref:System.Security.Cryptography.AesCng> object using an existing persisted key and you want to make use of that key when encrypting the message, you want to set the <xref:System.Security.Cryptography.SymmetricAlgorithm.IV%2A> property and then call the parameterless <xref:System.Security.Cryptography.AesCng.CreateEncryptor> overload instead; otherwise, using this method will create an ephemeral key as specified by the `rgbKey` parameter.
453+
450454
]]></format>
451455
</remarks>
452456
<exception cref="T:System.ArgumentNullException">
453457
<paramref name="rgbKey" /> is <see langword="null" />.</exception>
454458
<exception cref="T:System.ArgumentException">
455-
<paramref name="rgbKey" /> is not a valid size for this algorithm.
456-
457-
-or-
458-
459+
<paramref name="rgbKey" /> is not a valid size for this algorithm.
460+
461+
-or-
462+
459463
<paramref name="rgbIV" /> size does not match the block size for this algorithm.</exception>
460464
<exception cref="T:System.Security.Cryptography.CryptographicException">
461-
<paramref name="rgbKey" /> is a known weak key for this algorithm and cannot be used.
462-
463-
-or-
464-
465+
<paramref name="rgbKey" /> is a known weak key for this algorithm and cannot be used.
466+
467+
-or-
468+
465469
<paramref name="rgbIV" /> is <see langword="null" />.</exception>
466470
</Docs>
467471
</Member>
@@ -611,13 +615,13 @@
611615
<summary>Gets or sets the key for the <see cref="T:System.Security.Cryptography.AesCng" /> algorithm.</summary>
612616
<value>The key for the <see cref="T:System.Security.Cryptography.AesCng" /> algorithm.</value>
613617
<remarks>
614-
<format type="text/markdown"><![CDATA[
615-
616-
## Remarks
617-
If you've created the <xref:System.Security.Cryptography.AesCng> object using an existing persisted key, when you read the value of the <xref:System.Security.Cryptography.AesCng.Key%2A> property, an attempt to export the key will be made. In this case, if the key is not exportable, a <xref:System.Security.Cryptography.CryptographicException> will be thrown.
618-
619-
In addition to that, if you set the value of the <xref:System.Security.Cryptography.AesCng.Key%2A> property, the persisted key will no longer be used and a temporary key will be used instead. If you need to use the persisted key again, a new instance of <xref:System.Security.Cryptography.AesCng> class needs to be created.
620-
618+
<format type="text/markdown"><![CDATA[
619+
620+
## Remarks
621+
If you've created the <xref:System.Security.Cryptography.AesCng> object using an existing persisted key, when you read the value of the <xref:System.Security.Cryptography.AesCng.Key%2A> property, an attempt to export the key will be made. In this case, if the key is not exportable, a <xref:System.Security.Cryptography.CryptographicException> will be thrown.
622+
623+
In addition to that, if you set the value of the <xref:System.Security.Cryptography.AesCng.Key%2A> property, the persisted key will no longer be used and a temporary key will be used instead. If you need to use the persisted key again, a new instance of <xref:System.Security.Cryptography.AesCng> class needs to be created.
624+
621625
]]></format>
622626
</remarks>
623627
</Docs>
@@ -656,13 +660,13 @@
656660
<summary>Gets or sets the size, in bits, of the secret key used by the <see cref="T:System.Security.Cryptography.AesCng" /> algorithm.</summary>
657661
<value>The size, in bits, of the secret key used by the <see cref="T:System.Security.Cryptography.AesCng" /> algorithm.</value>
658662
<remarks>
659-
<format type="text/markdown"><![CDATA[
660-
661-
## Remarks
663+
<format type="text/markdown"><![CDATA[
664+
665+
## Remarks
662666
For AES, the legal key sizes are 128, 192, and 256 bits.
663667
664-
If you've created the <xref:System.Security.Cryptography.AesCng> object using an existing persisted key and you set the value of the <xref:System.Security.Cryptography.AesCng.KeySize%2A> property, the persisted key will no longer be used and an ephemeral key will be used instead. If you need to use the persisted key again, a new instance of <xref:System.Security.Cryptography.AesCng> class needs to be created.
665-
668+
If you've created the <xref:System.Security.Cryptography.AesCng> object using an existing persisted key and you set the value of the <xref:System.Security.Cryptography.AesCng.KeySize%2A> property, the persisted key will no longer be used and an ephemeral key will be used instead. If you need to use the persisted key again, a new instance of <xref:System.Security.Cryptography.AesCng> class needs to be created.
669+
666670
]]></format>
667671
</remarks>
668672
</Docs>

0 commit comments

Comments
 (0)