Xceed Encryption Library Documentation
Xceed Encryption control reference / Encryption Method objects / XceedRijndaelEncryptionMethod object / SetRandomSecretKey method
In This Topic
    SetRandomSecretKey method
    In This Topic

    SetRandomSecretKey method

    Description

    The SetRandomSecretKey method uses the Xceed Encryption Library's random number generator to create a Secret Key and then to automatically set the SecretKey property.

    In order to accomplish this task, the library uses a hashing algorithm during the process. Before calling this method, you may want to change the default hashing algorithm (or its parameters) by using the HashingMethod property.

    Parameters
     

    Parameters Description
    nKeySize  The size (in bits) of the Secret Key to produce. The length of the secret key determines the amount of bits that the secret-key encryption algorithm will use for encryption, and can only be set to a valid key size (128, 192 or 256 bits for Rijndael or Twofish ) or the library will raise an error.

     

    When using the SetRandomSecretKey or SetSecretKeyFromPassPhrase methods, the key size represents the desired key length in number of bits (128, 192 or 256).

    Return value

    None

    Associated properties

    HashingMethod, SecretKey

    Remarks

    Please see the random number generator topic to learn about the limitations of random number generators.

    Declaration (DXceedEncryption and IXceedEncryption) Copy Code

    HRESULT SetRandomSecretKey( [in] short nKeySize );