ECDiffieHellmanCng.DeriveKeyFromHmac(ECDiffieHellmanPublicKey, HashAlgorithmName, Byte[], Byte[], Byte[]) 方法
定义
使用指定的 HMAC(基于哈希的消息验证代码)算法对可选的添加数据或追加数据执行密钥派生。Performs key derivation using a specified HMAC (Hash-based Message Authentication Code) algorithm with optional prepended or appended data.
public:
override 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 override byte[] DeriveKeyFromHmac (System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[] hmacKey, byte[] secretPrepend, byte[] secretAppend);
public override byte[] DeriveKeyFromHmac (System.Security.Cryptography.ECDiffieHellmanPublicKey otherPartyPublicKey, System.Security.Cryptography.HashAlgorithmName hashAlgorithm, byte[]? hmacKey, byte[]? secretPrepend, byte[]? secretAppend);
override this.DeriveKeyFromHmac : System.Security.Cryptography.ECDiffieHellmanPublicKey * System.Security.Cryptography.HashAlgorithmName * byte[] * byte[] * byte[] -> byte[]
Public Overrides Function DeriveKeyFromHmac (otherPartyPublicKey As ECDiffieHellmanPublicKey, hashAlgorithm As HashAlgorithmName, hmacKey As Byte(), secretPrepend As Byte(), secretAppend As Byte()) As Byte()
参数
- otherPartyPublicKey
- ECDiffieHellmanPublicKey
另一方的公钥。The other party's public key.
- hashAlgorithm
- HashAlgorithmName
用于派生密钥材料的哈希算法。The hash algorithm to use to derive the key material.
- hmacKey
- Byte[]
HMAC 的密钥。The key for the HMAC.
- secretPrepend
- Byte[]
在进行哈希算法之前,要预置到派生密钥前面的值。A value to prepend to the derived secret before hashing.
- secretAppend
- Byte[]
在进行哈希算法之前,要追加到派生密钥的值。A value to append to the derived secret before hashing.
返回
- Byte[]
按需添加数据或追加数据之后的共享机密的 HMAC。The HMAC of the shared secret after prepending or appending data as requested.
例外
otherPartyPublicKey 使用的曲线的大小与此密钥使用的曲线不同。The curve used by otherPartyPublicKey has a different size than the curve from this key.
- 或 --or-
hashAlgorithm 参数未指定哈希值。The hashAlgorithm parameter does not specify a hash.
otherPartyPublicKey 为 null。otherPartyPublicKey is null.
otherPartyPublicKey使用的曲线与此密钥使用的曲线不同。The curve used by otherPartyPublicKey is different than the curve from this key.
- 或 --or-
此实例仅表示一个公钥。This instance represents only a public key.