ECDiffieHellman.DeriveKeyFromHmac 方法

定義

使用指定的 HMAC (雜湊式訊息驗證碼) 演算法來執行金鑰衍生。

多載

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

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

DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[])

使用指定的 HMAC (雜湊式訊息驗證碼) 演算法來執行金鑰衍生。

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

來源:
ECDiffieHellman.cs
來源:
ECDiffieHellman.cs
來源:
ECDiffieHellman.cs

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

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

參數

otherPartyPublicKey
ECDiffieHellmanPublicKey

另一方的公開金鑰。

hashAlgorithm
HashAlgorithmName

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

hmacKey
Byte[]

HMAC 的金鑰。

secretPrepend
Byte[]

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

secretAppend
Byte[]

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

傳回

Byte[]

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

例外狀況

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

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

-或-

hashAlgorithm 參數未指定雜湊。

otherPartyPublicKeynull

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

-或-

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

備註

此方法會在內部執行橢圓曲線Diffie-Hellman金鑰協定,以產生共用秘密 (z) 。

當 為 nullhmacKey ,此方法的傳回值是使用指定 HMAC 演算法的結果 HMAC-HASH(z, secretPrepend || z || secretAppend) ,其中 || 表示串連。 否則,這個方法的 HMAC-HASH(hmacKey, secretPrepend || z || secretAppend) 傳回值就是 的結果。

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

適用於

DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[])

來源:
ECDiffieHellman.cs
來源:
ECDiffieHellman.cs
來源:
ECDiffieHellman.cs

使用指定的 HMAC (雜湊式訊息驗證碼) 演算法來執行金鑰衍生。

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

參數

otherPartyPublicKey
ECDiffieHellmanPublicKey

另一方的公開金鑰。

hashAlgorithm
HashAlgorithmName

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

hmacKey
Byte[]

HMAC 的金鑰。

傳回

Byte[]

所共用密碼的 HMAC。

例外狀況

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

-或-

hashAlgorithm 參數未指定雜湊。

otherPartyPublicKeynull

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

-或-

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

備註

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

適用於