Encrypting Files

[This is preliminary documentation and subject to change.]

You can determine whether a file system supports file encryption for files and directories by calling the GetVolumeInformation function and examining the FILE_SUPPORTS_ENCRYPTION bit flag.

To encrypt a file, use the EncryptFile function. All data streams in the file are encrypted. If the file is already encrypted, EncryptFile does nothing but return a nonzero value, which indicates success. If the file is compressed, EncryptFile will decompress the file before encrypting it.

To decrypt an encrypted file, use the DecryptFile function. If the file is not encrypted, DecryptFile does nothing but return a nonzero value indicating success.