Skip to content

Commit dc05b0d

Browse files
authored
Key sizes can only be certain lengths (#3992)
* Key sizes can only be certain lengths The wording could be interpreted as "any value between 128 and 256 bits is valid" leading to confision. Specifying exact values will hopefully provide more clarity and eliminate confusion. See https://github.com/microsoft/referencesource/blob/master/System.Core/System/Security/Cryptography/AesCryptoServiceProvider.cs#L323 for implementation details. * Update AesCng.xml added same valid `KeySize` clarification to related `AesCng` class * Update AesCng.xml code review changes
1 parent 7f1ba7e commit dc05b0d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

xml/System.Security.Cryptography/AesCng.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,9 @@
645645
<remarks>
646646
<format type="text/markdown"><![CDATA[
647647
648-
## Remarks
648+
## Remarks
649+
For AES, the legal key sizes are 128, 192, and 256 bits.
650+
649651
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.
650652
651653
]]></format>

xml/System.Security.Cryptography/AesCryptoServiceProvider.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,7 +693,7 @@
693693
<format type="text/markdown"><![CDATA[
694694
695695
## Remarks
696-
The minimum size of the key is 128 bits, and the maximum size is 256 bits.
696+
For AES, the legal key sizes are 128, 192, and 256 bits.
697697
698698
Changing the `KeySize` value resets the key and generates a new random key. This happens whenever the `KeySize` property setter is invoked (including when it's assigned the same value).
699699

0 commit comments

Comments
 (0)