Skip to content

Add missing, and update existing, ECDH API documentation. #3542

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 23, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
162 changes: 134 additions & 28 deletions xml/System.Security.Cryptography/ECDiffieHellman.xml
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Derives bytes that can be used as a key using a hash function .</summary>
<summary>Performs key derivation using a specified hash algorithm.</summary>
</Docs>
</MemberGroup>
<Member MemberName="DeriveKeyFromHash">
Expand Down Expand Up @@ -294,9 +294,9 @@
</Parameters>
<Docs>
<param name="otherPartyPublicKey">The other party's public key.</param>
<param name="hashAlgorithm">The hash algorithm to use to derive the key material.</param>
<summary>Derives bytes that can be used as a key using a hash function, given another party's public key and hash algorithm's name.</summary>
<returns>The key material from the key exchange with the other party's public key.</returns>
<param name="hashAlgorithm">The hash algorithm to use to derive the key material.</param>
<summary>Performs key derivation using a specified hash algorithm.</summary>
<returns>The hash of the shared secret.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

Expand All @@ -306,7 +306,20 @@
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="otherPartyPublicKey" /> is over a different curve than this key.</exception>
The curve used by <paramref name="otherPartyPublicKey" /> has a different size than the curve from this key.

-or-

The <paramref name="hashAlgorithm"/> parameter does not specify a hash.
</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="otherPartyPublicKey" /> is <see langword="null"/>.</exception>
<exception cref="T:System.Security.Cryptography.CryptographicException">
The curve used by <paramref name="otherPartyPublicKey" /> is different than the curve from this key.

-or-

This instance represents only a public key.</exception>
</Docs>
</Member>
<Member MemberName="DeriveKeyFromHash">
Expand Down Expand Up @@ -340,15 +353,39 @@
</Parameters>
<Docs>
<param name="otherPartyPublicKey">The other party's public key.</param>
<param name="hashAlgorithm">The hash algorithm to use to derive the key material.</param>
<param name="hashAlgorithm">The hash algorithm to use to derive the key material.</param>
<param name="secretPrepend">A value to prepend to the derived secret before hashing.</param>
<param name="secretAppend">A value to append to the derived secret before hashing.</param>
<summary>When implemented in a derived class, derives bytes that can be used as a key using a hash function, given another party's public key, hash algorithm's name, a prepend value and an append value.</summary>
<returns>The key material from the key exchange with the other party's public key.</returns>
<remarks>To be added.</remarks>
<summary>When implemented in a derived class, performs key derivation using a specified hash algorithm with optional prepended or appended data.</summary>
<returns>The hash of the shared secret after prepending or appending data as requested.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks

This method internally performs the Elliptic Curve Diffie-Hellman key agreement to produce the shared secret (`z`).
The return value from this method is the result of `HASH(secretPrepend || z || secretAppend)` using the specified hash algorithm, where `||` signifies concatenation.

If the value of `secretPrepend` or `secretAppend` is `null`, they are treated as empty arrays.

]]></format>
</remarks>
<exception cref="T:System.NotImplementedException">A derived class must override this method.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="otherPartyPublicKey" /> is over a different curve than this key.</exception>
The curve used by <paramref name="otherPartyPublicKey" /> has a different size than the curve from this key.

-or-

The <paramref name="hashAlgorithm"/> parameter does not specify a hash.
</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="otherPartyPublicKey" /> is <see langword="null"/>.</exception>
<exception cref="T:System.Security.Cryptography.CryptographicException">
The curve used by <paramref name="otherPartyPublicKey" /> is different than the curve from this key.

-or-

This instance represents only a public key.</exception>
</Docs>
</Member>
<MemberGroup MemberName="DeriveKeyFromHmac">
Expand All @@ -357,7 +394,7 @@
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Derives bytes that can be used as a key using a Hash-based Message Authentication Code (HMAC).</summary>
<summary>Performs key derivation using a specified HMAC (Hash-based Message Authentication Code) algorithm.</summary>
</Docs>
</MemberGroup>
<Member MemberName="DeriveKeyFromHmac">
Expand Down Expand Up @@ -392,8 +429,8 @@
<param name="otherPartyPublicKey">The other party's public key.</param>
<param name="hashAlgorithm">The hash algorithm to use to derive the key material.</param>
<param name="hmacKey">The key for the HMAC.</param>
<summary>Derives bytes that can be used as a key using a Hash-based Message Authentication Code (HMAC).</summary>
<returns>The key material from the key exchange with the other party's public key.</returns>
<summary>Performs key derivation using a specified HMAC (Hash-based Message Authentication Code) algorithm.</summary>
<returns>The HMAC of the shared secret.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

Expand All @@ -403,7 +440,20 @@
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="otherPartyPublicKey" /> is over a different curve than this key.</exception>
The curve used by <paramref name="otherPartyPublicKey" /> has a different size than the curve from this key.

-or-

The <paramref name="hashAlgorithm"/> parameter does not specify a hash.
</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="otherPartyPublicKey" /> is <see langword="null"/>.</exception>
<exception cref="T:System.Security.Cryptography.CryptographicException">
The curve used by <paramref name="otherPartyPublicKey" /> is different than the curve from this key.

-or-

This instance represents only a public key.</exception>
</Docs>
</Member>
<Member MemberName="DeriveKeyFromHmac">
Expand Down Expand Up @@ -442,12 +492,37 @@
<param name="hmacKey">The key for the HMAC.</param>
<param name="secretPrepend">A value to prepend to the derived secret before hashing.</param>
<param name="secretAppend">A value to append to the derived secret before hashing.</param>
<summary>When implemented in a derived class, derives bytes that can be used as a key using a Hash-based Message Authentication Code (HMAC).</summary>
<returns>The key material from the key exchange with the other party's public key.</returns>
<remarks>To be added.</remarks>
<summary>When implemented in a derived class, performs key derivation using a specified HMAC (Hash-based Message Authentication Code) algorithm with optional prepended or appended data.</summary>
<returns>The HMAC of the shared secret after prepending or appending data as requested.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks

This method internally performs the Elliptic Curve Diffie-Hellman key agreement to produce the shared secret (`z`).

When `hmacKey` is `null`, the return value from this method is the result of `HMAC-HASH(z, secretPrepend || z || secretAppend)` using the specified HMAC algorithm, where `||` signifies concatenation. Otherwise, the return value from this method is the result of `HMAC-HASH(hmacKey, secretPrepend || z || secretAppend)`.

If the value of `secretPrepend` or `secretAppend` is `null`, they are treated as empty arrays.

]]></format>
</remarks>
<exception cref="T:System.NotImplementedException">A derived class must override this method.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="otherPartyPublicKey" /> is over a different curve than this key.</exception>
The curve used by <paramref name="otherPartyPublicKey" /> has a different size than the curve from this key.

-or-

The <paramref name="hashAlgorithm"/> parameter does not specify a hash.
</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="otherPartyPublicKey" /> is <see langword="null"/>.</exception>
<exception cref="T:System.Security.Cryptography.CryptographicException">
The curve used by <paramref name="otherPartyPublicKey" /> is different than the curve from this key.

-or-

This instance represents only a public key.</exception>
</Docs>
</Member>
<Member MemberName="DeriveKeyMaterial">
Expand Down Expand Up @@ -483,16 +558,27 @@
</Parameters>
<Docs>
<param name="otherPartyPublicKey">The other party's public key.</param>
<summary>Derives bytes that can be used as a key, given another party's public key.</summary>
<returns>The key material from the key exchange with the other party's public key.</returns>
<summary>When implemented in a derived class, performs a key derivation on the shared secret.</summary>
<returns>The result of the key derivation function, using the shared secret as an input.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks
For more information about public keys, see the <xref:System.Security.Cryptography.ECDiffieHellmanPublicKey> class.

The default behavior of this method is equivalent to calling <xref:System.Security.Cryptography.ECDiffieHellman.DeriveKeyFromHash%2A> specifying SHA-256 as the hash algorithm with no prepend or append values.
Some implementations allow the behavior of this method to be changed,
and callers are advised to call whichever method explicitly says it performs the key derivation they need.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
The curve used by <paramref name="otherPartyPublicKey" /> has a different size than the curve from this key.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="otherPartyPublicKey" /> is <see langword="null"/>.</exception>
<exception cref="T:System.Security.Cryptography.CryptographicException">
The curve used by <paramref name="otherPartyPublicKey" /> is different than the curve from this key.

-or-

This instance represents only a public key.</exception>
</Docs>
</Member>
<Member MemberName="DeriveKeyTls">
Expand Down Expand Up @@ -527,16 +613,36 @@
<param name="otherPartyPublicKey">The other party's public key.</param>
<param name="prfLabel">The ASCII-encoded PRF label.</param>
<param name="prfSeed">The 64-byte PRF seed.</param>
<summary>When implemented in a derived class, derives bytes that can be used as a key using a Transport Layer Security (TLS) Pseudo-Random Function (PRF) derivation algorithm.</summary>
<returns>The key material from the key exchange with the other party's public key.</returns>
<remarks>To be added.</remarks>
<summary>When implemented in a derived class, performs key derivation using the TLS (Transport Layer Security) 1.1 PRF (Pseudo-Random Function).</summary>
<returns>The first 48 bytes from the TLS 1.1 PRF, using the shared secret as the key.</returns>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks

This method internally performs the Elliptic Curve Diffie-Hellman key agreement to produce the shared secret (`z`).

The return value of this method is a 48 byte output of the TLS 1.1 PRF (Pseudo-Random Function),
`PRF(z, prfLabel, prfSeed)`.

For more information, see [IETF RFC 4346, section 5](https://tools.ietf.org/html/rfc4346#section-5).
]]></format>
</remarks>
<exception cref="T:System.NotImplementedException">A derived class must override this method.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="otherPartyPublicKey" /> is over a different curve than this key.</exception>
The curve used by <paramref name="otherPartyPublicKey" /> has a different size than the curve from this key.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="prfLabel" /> or <paramref name="prfSeed" /> is <see langword="null" />.</exception>
<paramref name="otherPartyPublicKey"/>, <paramref name="prfLabel" /> or <paramref name="prfSeed" /> is <see langword="null" />.</exception>
<exception cref="T:System.Security.Cryptography.CryptographicException">
<paramref name="prfSeed" /> is not exactly 64 bytes in length.</exception>
<paramref name="prfSeed" /> is not exactly 64 bytes in length.

-or-

The curve used by <paramref name="otherPartyPublicKey" /> is different than the curve from this key.

-or-

This instance represents only a public key.</exception>
</Docs>
</Member>
<Member MemberName="ExportECPrivateKey">
Expand Down
Loading