Skip to content

Commit 978d3a8

Browse files
bartonjsRon Petrusha
authored andcommitted
Add documentation for AesCcm and AesGcm (#2771)
* Add documentation for AesCcm and AesGcm * Update AesCcm.xml * Update AesGcm.xml * Update AesCcm.xml * Update AesGcm.xml * Apply suggestions from code review Co-Authored-By: Carlos Sanchez Lopez <[email protected]> Co-Authored-By: Ron Petrusha <[email protected]> * Remove paramrefs from summaries.
1 parent 85cba81 commit 978d3a8

File tree

2 files changed

+232
-78
lines changed

2 files changed

+232
-78
lines changed

xml/System.Security.Cryptography/AesCcm.xml

Lines changed: 116 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
</Interface>
1919
</Interfaces>
2020
<Docs>
21-
<summary>To be added.</summary>
21+
<summary>Represents an Advanced Encryption Standard (AES) key to be used with the Counter with CBC-MAC (CCM) mode of operation.</summary>
2222
<remarks>To be added.</remarks>
2323
</Docs>
2424
<Members>
@@ -38,9 +38,11 @@
3838
<Parameter Name="key" Type="System.Byte[]" />
3939
</Parameters>
4040
<Docs>
41-
<param name="key">To be added.</param>
42-
<summary>To be added.</summary>
41+
<param name="key">The secret key to use for this instance.</param>
42+
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AesCcm" /> class with a provided key.</summary>
4343
<remarks>To be added.</remarks>
44+
<exception cref="T:System.ArgumentNullException">The <paramref name="key" /> parameter is <see langword="null" />.</exception>
45+
<exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="key" /> parameter length is other than 16, 24, or 32 bytes (128, 192, or 256 bits).</exception>
4446
</Docs>
4547
</Member>
4648
<Member MemberName=".ctor">
@@ -59,9 +61,10 @@
5961
<Parameter Name="key" Type="System.ReadOnlySpan&lt;System.Byte&gt;" />
6062
</Parameters>
6163
<Docs>
62-
<param name="key">To be added.</param>
63-
<summary>To be added.</summary>
64+
<param name="key">The secret key to use for this instance.</param>
65+
<summary>Initializes a new instance of the <see cref="T:System.Security.Cryptography.AesCcm" /> class with a provided key.</summary>
6466
<remarks>To be added.</remarks>
67+
<exception cref="T:System.Security.Cryptography.CryptographicException">The <paramref name="key" /> parameter length is other than 16, 24, or 32 bytes (128, 192, or 256 bits).</exception>
6568
</Docs>
6669
</Member>
6770
<Member MemberName="Decrypt">
@@ -86,13 +89,32 @@
8689
<Parameter Name="associatedData" Type="System.Byte[]" />
8790
</Parameters>
8891
<Docs>
89-
<param name="nonce">To be added.</param>
90-
<param name="ciphertext">To be added.</param>
91-
<param name="tag">To be added.</param>
92-
<param name="plaintext">To be added.</param>
93-
<param name="associatedData">To be added.</param>
94-
<summary>To be added.</summary>
95-
<remarks>To be added.</remarks>
92+
<param name="nonce">The nonce associated with this message, which must match the value provided during encryption.</param>
93+
<param name="ciphertext">The encrypted content to decrypt.</param>
94+
<param name="tag">The authentication tag produced for this message during encryption.</param>
95+
<param name="plaintext">The byte array to receive the decrypted contents.</param>
96+
<param name="associatedData">Extra data associated with this message, which must match the value provided during encryption.</param>
97+
<summary>Decrypts the ciphertext into the provided destination buffer if the authentication tag can be validated.</summary>
98+
<remarks>
99+
<format type="text/markdown"><![CDATA[
100+
101+
## Remarks
102+
103+
If `tag` cannot be validated (using the key, `nonce`, `ciphertext`, and `associatedData` values), then `plaintext` is cleared.
104+
105+
]]></format>
106+
</remarks>
107+
<exception cref="T:System.ArgumentException">The <paramref name="plaintext" /> parameter and the <paramref name="ciphertext" /> do not have the same length.
108+
109+
-or-
110+
111+
The <paramref name="nonce"/> parameter length is not permitted by <see cref="P:System.Security.Cryptography.AesCcm.NonceByteSizes" />.
112+
113+
-or-
114+
115+
The <paramref name="tag"/> parameter length is not permitted by <see cref="P:System.Security.Cryptography.AesCcm.TagByteSizes" />.</exception>
116+
<exception cref="T:System.ArgumentNullException">The <paramref name="nonce" />, <paramref name="ciphertext" />, <paramref name="tag" />, or <paramref name="plaintext"/> parameter is <see langword="null" />.</exception>
117+
<exception cref="T:System.Security.Cryptography.CryptographicException">The tag value could not be verified, or the decryption operation otherwise failed.</exception>
96118
</Docs>
97119
</Member>
98120
<Member MemberName="Decrypt">
@@ -117,13 +139,31 @@
117139
<Parameter Name="associatedData" Type="System.ReadOnlySpan&lt;System.Byte&gt;" />
118140
</Parameters>
119141
<Docs>
120-
<param name="nonce">To be added.</param>
121-
<param name="ciphertext">To be added.</param>
122-
<param name="tag">To be added.</param>
123-
<param name="plaintext">To be added.</param>
124-
<param name="associatedData">To be added.</param>
125-
<summary>To be added.</summary>
126-
<remarks>To be added.</remarks>
142+
<param name="nonce">The nonce associated with this message, which must match the value provided during encryption.</param>
143+
<param name="ciphertext">The encrypted content to decrypt.</param>
144+
<param name="tag">The authentication tag produced for this message during encryption.</param>
145+
<param name="plaintext">The byte span to receive the decrypted contents.</param>
146+
<param name="associatedData">Extra data associated with this message, which must match the value provided during encryption.</param>
147+
<summary>Decrypts the ciphertext into the provided destination buffer if the authentication tag can be validated.</summary>
148+
<remarks>
149+
<format type="text/markdown"><![CDATA[
150+
151+
## Remarks
152+
153+
If `tag` cannot be validated (using the key, `nonce`, `ciphertext`, and `associatedData` values), then `plaintext` is cleared.
154+
155+
]]></format>
156+
</remarks>
157+
<exception cref="T:System.ArgumentException">The <paramref name="plaintext" /> parameter and the <paramref name="ciphertext" /> do not have the same length.
158+
159+
-or-
160+
161+
The <paramref name="nonce"/> parameter length is not permitted by <see cref="P:System.Security.Cryptography.AesCcm.NonceByteSizes" />.
162+
163+
-or-
164+
165+
The <paramref name="tag"/> parameter length is not permitted by <see cref="P:System.Security.Cryptography.AesCcm.TagByteSizes" />.</exception>
166+
<exception cref="T:System.Security.Cryptography.CryptographicException">The tag value could not be verified, or the decryption operation otherwise failed.</exception>
127167
</Docs>
128168
</Member>
129169
<Member MemberName="Dispose">
@@ -146,7 +186,7 @@
146186
</ReturnValue>
147187
<Parameters />
148188
<Docs>
149-
<summary>To be added.</summary>
189+
<summary>Releases the resources used by the current instance of the <see cref="T:System.Security.Cryptography.AesCcm" /> class.</summary>
150190
<remarks>To be added.</remarks>
151191
</Docs>
152192
</Member>
@@ -172,13 +212,32 @@
172212
<Parameter Name="associatedData" Type="System.Byte[]" />
173213
</Parameters>
174214
<Docs>
175-
<param name="nonce">To be added.</param>
176-
<param name="plaintext">To be added.</param>
177-
<param name="ciphertext">To be added.</param>
178-
<param name="tag">To be added.</param>
179-
<param name="associatedData">To be added.</param>
180-
<summary>To be added.</summary>
181-
<remarks>To be added.</remarks>
215+
<param name="nonce">The nonce associated with this message, which should be a unique value for every operation with the same key.</param>
216+
<param name="plaintext">The content to encrypt.</param>
217+
<param name="tag">The byte array to receive the generated authentication tag.</param>
218+
<param name="ciphertext">The byte array to receive the encrypted contents.</param>
219+
<param name="associatedData">Extra data associated with this message, which must also be provided during decryption.</param>
220+
<summary>Encrypts the plaintext into the ciphertext destination buffer and generates the authentication tag into a separate buffer.</summary>
221+
<remarks>
222+
<format type="text/markdown"><![CDATA[
223+
224+
## Remarks
225+
226+
The security guarantees of the AES-CCM algorithm mode require that the same nonce value is never used twice with the same key.
227+
228+
]]></format>
229+
</remarks>
230+
<exception cref="T:System.ArgumentException">The <paramref name="plaintext" /> parameter and the <paramref name="ciphertext" /> do not have the same length.
231+
232+
-or-
233+
234+
The <paramref name="nonce"/> parameter length is not permitted by <see cref="P:System.Security.Cryptography.AesCcm.NonceByteSizes" />.
235+
236+
-or-
237+
238+
The <paramref name="tag"/> parameter length is not permitted by <see cref="P:System.Security.Cryptography.AesCcm.TagByteSizes" />.</exception>
239+
<exception cref="T:System.ArgumentNullException">The <paramref name="nonce" />, <paramref name="ciphertext" />, <paramref name="tag" />, or <paramref name="plaintext"/> parameter is <see langword="null" />.</exception>
240+
<exception cref="T:System.Security.Cryptography.CryptographicException">The encryption operation failed.</exception>
182241
</Docs>
183242
</Member>
184243
<Member MemberName="Encrypt">
@@ -203,13 +262,31 @@
203262
<Parameter Name="associatedData" Type="System.ReadOnlySpan&lt;System.Byte&gt;" />
204263
</Parameters>
205264
<Docs>
206-
<param name="nonce">To be added.</param>
207-
<param name="plaintext">To be added.</param>
208-
<param name="ciphertext">To be added.</param>
209-
<param name="tag">To be added.</param>
210-
<param name="associatedData">To be added.</param>
211-
<summary>To be added.</summary>
212-
<remarks>To be added.</remarks>
265+
<param name="nonce">The nonce associated with this message, which should be a unique value for every operation with the same key.</param>
266+
<param name="plaintext">The content to encrypt.</param>
267+
<param name="tag">The byte span to receive the generated authentication tag.</param>
268+
<param name="ciphertext">The byte span to receive the encrypted contents.</param>
269+
<param name="associatedData">Extra data associated with this message, which must also be provided during decryption.</param>
270+
<summary>Encrypts the plaintext into the ciphertext destination buffer and generates the authentication tag into a separate buffer.</summary>
271+
<remarks>
272+
<format type="text/markdown"><![CDATA[
273+
274+
## Remarks
275+
276+
The security guarantees of the AES-CCM algorithm mode require that the same nonce value is never used twice with the same key.
277+
278+
]]></format>
279+
</remarks>
280+
<exception cref="T:System.ArgumentException">The <paramref name="plaintext" /> parameter and the <paramref name="ciphertext" /> do not have the same length.
281+
282+
-or-
283+
284+
The <paramref name="nonce"/> parameter length is not permitted by <see cref="P:System.Security.Cryptography.AesCcm.NonceByteSizes" />.
285+
286+
-or-
287+
288+
The <paramref name="tag"/> parameter length is not permitted by <see cref="P:System.Security.Cryptography.AesCcm.TagByteSizes" />.</exception>
289+
<exception cref="T:System.Security.Cryptography.CryptographicException">The encryption operation failed.</exception>
213290
</Docs>
214291
</Member>
215292
<Member MemberName="NonceByteSizes">
@@ -228,8 +305,8 @@
228305
<ReturnType>System.Security.Cryptography.KeySizes</ReturnType>
229306
</ReturnValue>
230307
<Docs>
231-
<summary>To be added.</summary>
232-
<value>To be added.</value>
308+
<summary>Gets the nonce sizes, in bytes, supported by this instance.</summary>
309+
<value>The nonce sizes supported by this instance: 7, 8, 9, 10, 11, 12, or 13 bytes (56, 64, 72, 80, 88, 96, or 104 bits).</value>
233310
<remarks>To be added.</remarks>
234311
</Docs>
235312
</Member>
@@ -249,10 +326,10 @@
249326
<ReturnType>System.Security.Cryptography.KeySizes</ReturnType>
250327
</ReturnValue>
251328
<Docs>
252-
<summary>To be added.</summary>
253-
<value>To be added.</value>
329+
<summary>Gets the tag sizes, in bytes, supported by this instance.</summary>
330+
<value>The tag sizes supported by this instance: 4, 6, 8, 10, 12, 14, or 16 bytes (32, 48, 64, 80, 96, 112, or 128 bits).</value>
254331
<remarks>To be added.</remarks>
255332
</Docs>
256333
</Member>
257334
</Members>
258-
</Type>
335+
</Type>

0 commit comments

Comments
 (0)