Xceed Encryption Library Documentation
ProcessFile method
Xceed Encryption control reference > Methods > ProcessFile method

Description

The ProcessFile method can encrypt or decrypt data from one file to another.

Parameters
 

Parameter Description
sSourceFilename  The path and filename of the source file to encrypt or decrypt.
lSourceOffset  The starting offset in the source file to begin processing data from. Specify 0 to begin processing data from the beginning of the file.
lSourceSize  The amount of data to process. Specify 0 to process data from the starting offset until the end of the file.
eAction  The type of processing that should be performed. Specify efpEncrypt to encrypt the data. Specify efpDecrypt to decrypt the data.
bEndOfData  Determines whether or not the source data to process is the final (or the only) portion of data to process. Specify True if the source data should be completely encrypted or decrypted and written to the destination file. If the data to process is split apart in various sections of the same file, or in various files, then you can specify False in this parameter until all the source data has been processed.

 

You can specify True for the last portion of data (which can be 0 bytes long) so that the library knows it must finish processing all the provided source data and flush its buffers to the destination file. When specifying False, the library will expect you to call the ProcessFile method again later with either a new source filename and/or source offset and/or source size.
sDestFilename  The path and filename of the file to write the encrypted or decrypted data to. If the file does not already exist, it will be created and written to. If the file already exists, the library can either clear the file and write to it as a new file, or it can append the processed data to the end of the destination file.
bAppend  Determines the behavior of the library when the destination file already exists. Specify True to append to an existing file, or False to clear the file and write processed data to it as a new file.
vaBytesRead  You must provide a variant variable in this parameter. Right before the ProcessFile method completes and returns, the library will write to the variable the amount of bytes read and processed from the source file.

Return value

Returns a long integer indicating the amount of bytes written to the destination file..

Associated properties

When encrypting data: EncryptionMethod, EncryptionMode, InitVector, SecretKey, PublicKey.

When decrypting data: EncryptionMethod, EncryptionMode, InitVector, SecretKey, PrivateKey.

Remarks

When calling the ProcessFile method with the bEndOfData parameter specified as False, you cannot call any other Xceed Encryption control method (of the same instance of the control) until you have completed processing a stream of data by calling the ProcessFile method with the bEndOfData parameter specified as True, or an error occurs, or the Reset method is called.

When encrypting with a secret-key encryption algorithm, the library may automatically pad the last encrypted block with a fixed value (the value used corresponds to the number of bytes padded). The PaddingMethod property determines exactly how padding will be performed. When decrypting, the library will make sure that these padding characters are recognized and ignored. This padding scheme implies that there may be an additional block at the end of the encrypted data stream containing bytes of all the same plain text value (usually 16).

Declaration (DXceedEncryption) Copy Code
HRESULT ProcessFile
(
  [in] BSTR sSourceFilename,
  [in] long lSourceOffset,
  [in] long lSourceSize,
  [in] EXEFileProcessing eAction,
  [in] VARIANT_BOOL bEndOfData,
  [in] BSTR sDestFilename,
  [in] VARIANT_BOOL bAppend,
  [out] VARIANT* vaBytesRead,
  [retval][out] long* lWritten
)
Declaration (IXceedEncryption) Copy Code

HRESULT ProcessFile
(
  [in] BSTR sSourceFilename,
  [in] DWORD dwSourceOffset,
  [in] DWORD dwSourceSize,
  [in] EXEFileProcessing eAction,
  [in] BOOL bEndOfData,
  [in] BSTR sDestFilename,
  [in] BOOL bAppend,
  [out] DWORD* pdwBytesRead,
  [out] DWORD* pdwWritten
)