@msdn=https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-encryptfilea @pinvoke=http://pinvoke.net/$$$.htm Summary: EncryptFile turns on file level system encryption for a specific file or folder !!!!C# Signature: [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError=true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool EncryptFile(string filename); !!!!VB Signature: Declare Function EncryptFile Lib "advapi32.dll" (TODO) As TODO !!!!User-Defined Types: None. !!!!Notes: This requires that Windows supports Encrypted File System (EFS) which is only supported under NTFS. !!!!Tips & Tricks: Please add some! !!!!C# Sample Code: [DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError=true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool EncryptFile(string filename); string FileName = "C:\PATH\TO\YOUR\FILE"; if(EncryptFile(FileName)){ //File encrypted } else{ throw new Exception("Encryption failed."); } !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: Encryptfile@msdn on MSDN
Edit advapi32.Encryptfile
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.