Xceed Encryption Library Documentation
SetSecretKeyFromPassPhrase method
Xceed Encryption control reference > Encryption Method objects > XceedRijndaelEncryptionMethod object > SetSecretKeyFromPassPhrase method

Description

The SetSecretKeyFromPassPhrase method applies a hash function to a PassPhrase and then sets the SecretKey property equal to the resulting hash value.

Before calling this method, you may want to change the default hashing algorithm (or its parameters) by using the HashingMethod property.

Parameters
 

Parameters Description
sPassPhrase  The PassPhrase to hash.
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

The PassPhrase must have at least 1 character.

See the PassPhrase topic for tips on selecting a good phrase.

Declaration (DXceedEncryption and IXceedEncryption) Copy Code

HRESULT SetSecretKeyFromPassPhrase( [in] BSTR sPassPhrase, [in] short nKeySize )