Skip to content

Commit 1fb5178

Browse files
authored
Documentation consistency for PQC types
1 parent 33f2533 commit 1fb5178

File tree

3 files changed

+43
-14
lines changed

3 files changed

+43
-14
lines changed

src/libraries/Common/src/System/Security/Cryptography/MLDsa.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ namespace System.Security.Cryptography
1414
/// Represents an ML-DSA key.
1515
/// </summary>
1616
/// <remarks>
17-
/// Developers are encouraged to program against the <see cref="MLDsa"/> base class,
18-
/// rather than any specific derived class.
19-
/// The derived classes are intended for interop with the underlying system
20-
/// cryptographic libraries.
17+
/// <para>
18+
/// This algorithm is specified by FIPS-204.
19+
/// </para>
20+
/// <para>
21+
/// Developers are encouraged to program against the <see cref="MLDsa"/> base class,
22+
/// rather than any specific derived class.
23+
/// The derived classes are intended for interop with the underlying system
24+
/// cryptographic libraries.
25+
/// </para>
2126
/// </remarks>
2227
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
2328
public abstract partial class MLDsa : IDisposable
@@ -39,6 +44,9 @@ public abstract partial class MLDsa : IDisposable
3944
/// <summary>
4045
/// Gets the specific ML-DSA algorithm for this key.
4146
/// </summary>
47+
/// <value>
48+
/// The specific ML-DSA algorithm for this key.
49+
/// </value>
4250
public MLDsaAlgorithm Algorithm { get; }
4351
private bool _disposed;
4452

@@ -48,6 +56,9 @@ public abstract partial class MLDsa : IDisposable
4856
/// <param name="algorithm">
4957
/// The specific ML-DSA algorithm for this key.
5058
/// </param>
59+
/// <exception cref="ArgumentNullException">
60+
/// <paramref name="algorithm" /> is <see langword="null" />.
61+
/// </exception>
5162
protected MLDsa(MLDsaAlgorithm algorithm)
5263
{
5364
ArgumentNullException.ThrowIfNull(algorithm);
@@ -79,7 +90,7 @@ public void Dispose()
7990
}
8091

8192
/// <summary>
82-
/// Sign the specified data, writing the signature into the provided buffer.
93+
/// Signs the specified data, writing the signature into the provided buffer.
8394
/// </summary>
8495
/// <param name="data">
8596
/// The data to sign.

src/libraries/Common/src/System/Security/Cryptography/MLKem.cs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public abstract partial class MLKem : IDisposable
4040
public static bool IsSupported => MLKemImplementation.IsSupported;
4141

4242
/// <summary>
43-
/// Gets the algorithm of the current instance.
43+
/// Gets the specific ML-KEM algorithm for this key.
4444
/// </summary>
4545
/// <value>
46-
/// A value representing the ML-KEM algorithm.
46+
/// The specific ML-KEM algorithm for this key.
4747
/// </value>
4848
public MLKemAlgorithm Algorithm { get; }
4949

@@ -183,6 +183,14 @@ public void Encapsulate(out byte[] ciphertext, out byte[] sharedSecret)
183183
/// <param name="sharedSecret">
184184
/// The buffer to receive the shared secret.
185185
/// </param>
186+
/// <remarks>
187+
/// Decapsulation can only decapsulate a shared secret created with the the decapsulation key's
188+
/// corresponding encapsulation key. If a different key is used, ML-KEM performs implicit rejection.
189+
/// Implicit rejection means an error will not be returned. Instead, the shared secret will be a
190+
/// deterministic but incorrect result.
191+
/// Detecting incorrect key use is a concern for consumers of the ML-KEM algorithm.
192+
/// For more information, see FIPS 203, Section 6.3.
193+
/// </remarks>
186194
/// <exception cref="CryptographicException">
187195
/// An error occurred during decapsulation.
188196
/// </exception>
@@ -219,6 +227,14 @@ public void Decapsulate(ReadOnlySpan<byte> ciphertext, Span<byte> sharedSecret)
219227
/// <returns>
220228
/// The shared secret.
221229
/// </returns>
230+
/// <remarks>
231+
/// Decapsulation can only decapsulate a shared secret created with the the decapsulation key's
232+
/// corresponding encapsulation key. If a different key is used, ML-KEM performs implicit rejection.
233+
/// Implicit rejection means an error will not be returned. Instead, the shared secret will be a
234+
/// deterministic but incorrect result.
235+
/// Detecting incorrect key use is a concern for consumers of the ML-KEM algorithm.
236+
/// For more information, see FIPS 203, Section 6.3.
237+
/// </remarks>
222238
/// <exception cref="CryptographicException">
223239
/// An error occurred during decapsulation.
224240
/// </exception>

src/libraries/Common/src/System/Security/Cryptography/SlhDsa.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,15 @@ namespace System.Security.Cryptography
1414
/// Represents an SLH-DSA key.
1515
/// </summary>
1616
/// <remarks>
17-
/// Developers are encouraged to program against the <c>SlhDsa</c> base class,
18-
/// rather than any specific derived class.
19-
/// The derived classes are intended for interop with the underlying system
20-
/// cryptographic libraries.
17+
/// <para>
18+
/// This algorithm is specified by FIPS-205.
19+
/// </para>
20+
/// <para>
21+
/// Developers are encouraged to program against the <see cref="SlhDsa"/> base class,
22+
/// rather than any specific derived class.
23+
/// The derived classes are intended for interop with the underlying system
24+
/// cryptographic libraries.
25+
/// </para>
2126
/// </remarks>
2227
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
2328
public abstract partial class SlhDsa : IDisposable
@@ -62,9 +67,6 @@ protected SlhDsa(SlhDsaAlgorithm algorithm)
6267
Algorithm = algorithm;
6368
}
6469

65-
/// <summary>
66-
/// Throws <see cref="ObjectDisposedException" /> if the current instance is disposed.
67-
/// </summary>
6870
private protected void ThrowIfDisposed() => ObjectDisposedException.ThrowIf(_disposed, typeof(SlhDsa));
6971

7072
/// <summary>

0 commit comments

Comments
 (0)