The WriteFile method can encrypt and decrypt data from memory and write it directly to a file.
Parameter | Description |
---|---|
vaData | The data to encrypt or decrypt. All OLE automation variant types are supported, including string and byte array variants. |
eAction | The type of processing that should be performed. Specify efpEncrypt to encrypt data. Specify efpDecrypt to decrypt data. |
bEndOfData | Determines whether or not the data provided in the vaData parameter is the final (or the only) portion of data to process. Specify True if the data should be completely encrypted or decrypted and written to the file. If the data to process must be processed in streaming fashion, 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. |
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. |
Returns the amount of bytes written to the destination file.
When encrypting data: EncryptionMethod, EncryptionMode, InitVector, SecretKey, PublicKey.
When decrypting data: EncryptionMethod, EncryptionMode, InitVector, SecretKey, PrivateKey.
ToString and FromString
When calling the WriteFile 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 WriteFile 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 WriteFile |
Declaration (IXceedEncryption) | Copy Code |
---|---|
|