Search code examples
c#.netntfsencrypting-file-system

How to determine whether a file is encrypted with EFS?


Is there a library method somewhere for figuring out whether a file has been encrypted with EFS? I see the Encrypt() and Decrypt() methods on FileInfo, but am looking for a way to query a file's state.


Solution

  • Use GetFileAttributes(), and check for FILE_ATTRIBUTE_ENCRYPTED.