SymmetricSecurityKey.GenerateDerivedKey(String, Byte[], Byte[], Int32, Int32) 方法

定义

在派生类中重写时,使用指定的加密算法和参数生成当前密钥的派生密钥。When overridden in a derived class, generates a derived key using the specified cryptographic algorithm and parameters for the current key.

public:
 abstract cli::array <System::Byte> ^ GenerateDerivedKey(System::String ^ algorithm, cli::array <System::Byte> ^ label, cli::array <System::Byte> ^ nonce, int derivedKeyLength, int offset);
public abstract byte[] GenerateDerivedKey (string algorithm, byte[] label, byte[] nonce, int derivedKeyLength, int offset);
abstract member GenerateDerivedKey : string * byte[] * byte[] * int * int -> byte[]
Public MustOverride Function GenerateDerivedKey (algorithm As String, label As Byte(), nonce As Byte(), derivedKeyLength As Integer, offset As Integer) As Byte()

参数

algorithm
String

一个 URI,表示用于生成派生密钥的加密算法。A URI that represents the cryptographic algorithm to use to generate the derived key.

label
Byte[]

一个 Byte 数组,它包含加密算法的标签参数。An array of Byte that contains the label parameter for the cryptographic algorithm.

nonce
Byte[]

一个 Byte 数组,它包含用于创建派生密钥的 Nonce。An array of Byte that contains the nonce that is used to create a derived key.

derivedKeyLength
Int32

派生密钥的大小。The size of the derived key.

offset
Int32

派生密钥在从此方法返回的字节数组中的位置。The position at which the derived key is located in the byte array that is returned from this method.

返回

Byte[]

包含派生密钥的 Byte 数组。An array of Byte that contains the derived key.

注解

若要将 P-SHA1 指定为加密算法,请使用 Psha1KeyDerivation 字段。To specify P-SHA1 as the cryptographic algorithm, use the Psha1KeyDerivation field.

由于 SHA1 出现冲突问题,Microsoft 建议使用基于 SHA256 或更好的安全模型。Due to collision problems with SHA1, Microsoft recommends a security model based on SHA256 or better.

适用于