ECDiffieHellman.DeriveKeyFromHmac 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
使用指定的 HMAC(基於雜湊的訊息認證碼)演算法執行金鑰導出。
多載
| 名稱 | Description |
|---|---|
| DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[]) |
當在衍生類別中實作時,會使用指定的 HMAC(基於雜湊的訊息驗證碼)演算法執行金鑰推導,並可選擇前置或附加資料。 |
| DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[]) |
使用指定的 HMAC(基於雜湊的訊息認證碼)演算法執行金鑰導出。 |
DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[])
當在衍生類別中實作時,會使用指定的 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[]
一個在雜湊前附加於衍生秘密的值。
傳回
在依要求前置或附加資料後,共享秘密的 HMAC。
例外狀況
必須有一個衍生類別覆寫此方法。
otherPartyPublicKey 是 null。
備註
此方法內部執行橢圓曲線 Diffie-Hellman 密鑰一致,產生共享祕密(z)。
當 hmacKey 時 null,該方法的回傳值是使用指定 HMAC 演算法的 HMAC-HASH(z, secretPrepend || z || secretAppend) 結果,其中 || 表示串接。 否則,此方法的回傳值即為 的結果 HMAC-HASH(hmacKey, secretPrepend || z || secretAppend)。
若 的secretPrependsecretAppend值為 null,則視為空陣列。
適用於
DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[])
使用指定的 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的鑰匙。
傳回
共享秘密的HMAC。
例外狀況
otherPartyPublicKey 是 null。
備註
此過載會呼叫方法, DeriveKeyFromHmac 傳遞 null 前置值與附加值。