ECDiffieHellman.DeriveKeyFromHmac 方法

定义

使用指定的 HMAC(基于哈希的消息验证代码)算法执行密钥派生。

重载

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

在派生类中实现时,使用指定的 HMAC(基于哈希的消息验证代码)算法对可选的添加数据或追加数据执行密钥派生。

DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[])

使用指定的 HMAC(基于哈希的消息验证代码)算法执行密钥派生。

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

Source:
ECDiffieHellman.cs
Source:
ECDiffieHellman.cs
Source:
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)

如果 或 secretAppendnullsecretPrepend值为 ,则它们被视为空数组。

适用于

DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[])

Source:
ECDiffieHellman.cs
Source:
ECDiffieHellman.cs
Source:
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 的方法。

适用于