Encrypts data.
Unit
Syntax
ParametersAData [in] Sensitive data to encrypt.
ADataSize [in] Size of AData.
AProtectedData [out] Encrypted data. Can be deleted by FreeMem function (but we recommend to use SecureFree function instead).
AProtectedDataSize [out] Size of AProtectedData.
ASameMachine [in, optional] False (default) - encrypt data using currently logged in user; True - encrypt data using computer info only.
AData [in] Sensitive data to encrypt.
AData [in, out] On input: sensitive data to encrypt. Must be allocated with AllocMem function. On output: encrypted data (size will be different). Can be deleted by EncryptBufferFree or SecureFree functions.
AProtectedData [out] Encrypted data (size will be different). Delete this data by EncryptBufferFree or SecureFree functions.
Return valueEncrypted data (size will be different).
RemarksThis function encrypts data. Typically, only a user with the same logon credential as the user who encrypted the data can decrypt the data (when ASameMachine is False). In addition, the encryption and decryption usually must be done on the same computer.
You can use this function to save data that you want to decrypt later. If you want to protect sensitive data in your process memory while running - use MemProtect function.
Call the DataUnprotect function to decrypt data encrypted with the DataProtect function. When you have finished using the sensitive information, clear it from memory by calling the FillChar function.
The function creates a session key to perform the encryption. The session key is derived again when the data is to be decrypted.
The function also adds a Message Authentication Code (MAC) (keyed integrity check) to the encrypted data to guard against data tampering.
See also
|