|
1332 | 1332 | |
1333 | 1333 | ## Remarks |
1334 | 1334 | The <xref:System.IO.File.Decrypt%2A> method allows you to decrypt a file that was encrypted using the <xref:System.IO.File.Encrypt%2A> method. The <xref:System.IO.File.Decrypt%2A> method can decrypt only files that were encrypted using the current user account. |
1335 | | - |
| 1335 | +
|
| 1336 | + > [!IMPORTANT] |
| 1337 | + > This API is only supported on Windows platforms that are able to use the NTFS Encrypting File System (EFS). Any attempt to use this on non-Windows systems, Windows Home Edition systems, or non-NTFS drives results in a <xref:System.PlatformNotSupportedException> or <xref:System.NotSupportedException>, depending on the situation. |
| 1338 | + > |
| 1339 | + > Use of this API in .NET Core is not recommended; it is included to enable portability for applications that move to .NET Core but still explicitly target Windows. |
| 1340 | +
|
1336 | 1341 | The <xref:System.IO.File.Decrypt%2A> method requires exclusive access to the file being decrypted, and will raise an exception if another process is using the file. If the file is not encrypted, <xref:System.IO.File.Decrypt%2A> will return a nonzero value, which indicates success. |
1337 | 1342 | |
1338 | 1343 | Both the <xref:System.IO.File.Encrypt%2A> method and the <xref:System.IO.File.Decrypt%2A> method use the cryptographic service provider (CSP) installed on the computer and the file encryption keys of the process calling the method. |
1339 | 1344 | |
1340 | 1345 | The current file system must be formatted as NTFS and the current operating system must be Windows NT or later. |
1341 | | - |
1342 | 1346 | |
1343 | | - |
1344 | 1347 | ## Examples |
1345 | 1348 | The following code example uses the <xref:System.IO.File.Encrypt%2A> method and the <xref:System.IO.File.Decrypt%2A> method to encrypt and then decrypt a file. The file must exist for the example to work. |
1346 | 1349 | |
|
1511 | 1514 | <summary>Encrypts a file so that only the account used to encrypt the file can decrypt it.</summary> |
1512 | 1515 | <remarks> |
1513 | 1516 | <format type="text/markdown"><![CDATA[ |
1514 | | - |
1515 | 1517 | ## Remarks |
1516 | 1518 | The <xref:System.IO.File.Encrypt%2A> method allows you to encrypt a file so that only the account used to call this method can decrypt it. Use the <xref:System.IO.File.Decrypt%2A> method to decrypt a file encrypted by the <xref:System.IO.File.Encrypt%2A> method. |
1517 | | - |
| 1519 | +
|
| 1520 | + > [!IMPORTANT] |
| 1521 | + > This API is only supported on Windows platforms that are able to use the NTFS Encrypting File System (EFS). Any attempt to use this on non-Windows systems, Windows Home Edition systems, or non-NTFS drives results in a <xref:System.PlatformNotSupportedException> or <xref:System.NotSupportedException>, depending on the situation. |
| 1522 | + > |
| 1523 | + > Use of this API in .NET Core is not recommended; it is included to enable portability for applications that move to .NET Core but still explicitly target Windows. |
| 1524 | +
|
1518 | 1525 | The <xref:System.IO.File.Encrypt%2A> method requires exclusive access to the file being encrypted, and will fail if another process is using the file. |
1519 | 1526 | |
1520 | 1527 | Both the <xref:System.IO.File.Encrypt%2A> method and the <xref:System.IO.File.Decrypt%2A> method use the cryptographic service provider (CSP) installed on the computer and the file encryption keys of the process calling the method. |
|
1523 | 1530 | |
1524 | 1531 | The current file system must be formatted as NTFS. |
1525 | 1532 | |
1526 | | - |
1527 | | - |
1528 | 1533 | ## Examples |
1529 | 1534 | The following code example uses the <xref:System.IO.File.Encrypt%2A> method and the <xref:System.IO.File.Decrypt%2A> method to encrypt and then decrypt a file. The file must exist for the example to work. |
1530 | 1535 | |
|
0 commit comments