ECDiffieHellman.DeriveKeyFromHash 方法

定義

使用所指定雜湊演算法來執行金鑰衍生。

多載

DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName)

使用所指定雜湊演算法來執行金鑰衍生。

DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[])

在衍生類別中實作時,使用指定的雜湊演算法搭配選擇性前置或附加資料來執行金鑰衍生。

DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName)

使用所指定雜湊演算法來執行金鑰衍生。

public:
 cli::array <System::Byte> ^ DeriveKeyFromHash(System::Security::Cryptography::ECDiffieHellmanPublicKey ^ otherPartyPublicKey, System::Security::Cryptography::HashAlgorithmName hashAlgorithm);
public byte[] DeriveKeyFromHash (System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm);
member this.DeriveKeyFromHash : System.Security.Cryptography.ECDiffieHellmanPublicKey * System.Security.Cryptography.HashAlgorithmName -> byte[]
Public Function DeriveKeyFromHash (otherPartyPublicKey As ECDiffieHellmanPublicKey, hashAlgorithm As HashAlgorithmName) As Byte()

參數

otherPartyPublicKey
ECDiffieHellmanPublicKey

另一方的公開金鑰。

hashAlgorithm
HashAlgorithmName

要用來衍生金鑰內容的雜湊演算法。

傳回

Byte[]

所共用密碼的雜湊。

例外狀況

otherPartyPublicKey 所使用曲線與此金鑰的曲線大小不同。

-或-

hashAlgorithm 參數未指定雜湊。

otherPartyPublicKeynull

otherPartyPublicKey 所使用曲線與此金鑰的曲線不同。

-或-

這個執行個體只表示公開金鑰。

備註

這個多載會 DeriveKeyFromHash 呼叫方法,以前置和附加值的形式傳遞 null

適用於

DeriveKeyFromHash(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[])

在衍生類別中實作時,使用指定的雜湊演算法搭配選擇性前置或附加資料來執行金鑰衍生。

public:
 virtual cli::array <System::Byte> ^ DeriveKeyFromHash(System::Security::Cryptography::ECDiffieHellmanPublicKey ^ otherPartyPublicKey, System::Security::Cryptography::HashAlgorithmName hashAlgorithm, cli::array <System::Byte> ^ secretPrepend, cli::array <System::Byte> ^ secretAppend);
public virtual byte[] DeriveKeyFromHash (System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? secretPrepend, byte[]? secretAppend);
public virtual byte[] DeriveKeyFromHash (System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] secretPrepend, byte[] secretAppend);
abstract member DeriveKeyFromHash : System.Security.Cryptography.ECDiffieHellmanPublicKey * System.Security.Cryptography.HashAlgorithmName * byte[] * byte[] -> byte[]
override this.DeriveKeyFromHash : System.Security.Cryptography.ECDiffieHellmanPublicKey * System.Security.Cryptography.HashAlgorithmName * byte[] * byte[] -> byte[]
Public Overridable Function DeriveKeyFromHash (otherPartyPublicKey As ECDiffieHellmanPublicKey, hashAlgorithm As HashAlgorithmName, secretPrepend As Byte(), secretAppend As Byte()) As Byte()

參數

otherPartyPublicKey
ECDiffieHellmanPublicKey

另一方的公開金鑰。

hashAlgorithm
HashAlgorithmName

要用來衍生金鑰內容的雜湊演算法。

secretPrepend
Byte[]

雜湊之前要加在衍生密碼前面的值。

secretAppend
Byte[]

雜湊之前要附加至衍生密碼的值。

傳回

Byte[]

依要求前置或附加資料後的共用密碼雜湊。

例外狀況

衍生的類別必須覆寫這個方法。

otherPartyPublicKey 所使用曲線與此金鑰的曲線大小不同。

-或-

hashAlgorithm 參數未指定雜湊。

otherPartyPublicKeynull

otherPartyPublicKey 所使用曲線與此金鑰的曲線不同。

-或-

這個執行個體只表示公開金鑰。

備註

此方法會在內部執行橢圓曲線Diffie-Hellman金鑰協定,以產生共用秘密 (z) 。 此方法的傳回值是使用指定雜湊演算法的結果 HASH(secretPrepend || z || secretAppend) ,其中 || 表示串連。

如果 或 secretAppend 的值 secretPrependnull ,則會將其視為空陣列。

適用於