Dear Rez9 Rez9
Thank you for posting in the Microsoft community.
I'm sorry to hear you're experiencing this issue.
This is a common scenario around Windows file encryption (EFS, Encrypting File System): i.e., after files have been encrypted, if user accounts and certificates on the system are removed (e.g., by formatting or reinstalling the system), these encrypted files cannot be accessed or decrypted unless you have backed up the necessary keys and certificates beforehand.
Why does decryption fail
- Windows uses EFS technology to encrypt files. By default, EFS generates encryption keys (also known as “certificates”) to encrypt files based on your user account.
- These keys are stored on the local system. If you format the C drive, overwrite/delete your user account or Windows installation, the private key required for decryption will be lost.
- Even if you save the file, missing the certificate and key, Windows can no longer access the encrypted data of the file.
Situation analysis: Is it possible to recover the files
Whether you can recover the file or not depends entirely on the following points:
- Have you backed up the certificate and key
If you exported the EFS key or certificate before formatting, you can re-import and decrypt the file.
- Is there an old system image or undeleted Windows backup?
Check to see if there are any system backups, restore points, or content transferred to an external device.
- Have old accounts and passwords been reset
An exact match user account was created (including the same username and password), which may be useful in some cases (not common).
- Was a third-party tool used to decrypt?
Without keys and certificates, it is very difficult to decrypt the files, as they are protected by strong encryption (and very long time to break them by force). However, tools are still available to try to recover the data.
Check if the encryption key (certificate) is backed up
-If, when encrypting a file, Windows prompts you to back up the file's encryption certificate and export it (usually generating a .pfx file), this will be the most effective decryption solution.
-Check to see if the certificate was ever saved, possible locations include:
USB flash drive or external hard disk.
Local file: file name similar to *.pfx.
Backup via email or cloud.
Steps: Restore the encryption certificate to the system
1. Import the certificate:
Copy the .pfx file to the current system.
Press Win + R, type mmc, and press Enter.
In the console window, go to File -> Add/Remove Management Units -> Certificates -> My User Accounts. o On the left side, navigate to Certificates.
Navigate to Certificates -> Personal on the left hand side and right click Import.
Browse and select the .pfx file and complete the import.
2. Decrypt the file:
Locate the encrypted file, right click and select Properties -> Advanced. o Uncheck the “Encrypted File” box.
Uncheck “Encrypt content to protect data”.
If the certificate matches, the file should be decrypted successfully.
Trying to recover the private key file using an old system or backup
If the .pfx file cannot be found, check for an old backup file or system image, which may still contain the encryption key.
Check the system backup/image:
- If you have created a system interface using the backup that came with Windows or another tool such as Acronis True Image, try restoring the old system before formatting the C: drive.
- After entering the old system, export the certificate:
Press win+s to search for Powershell>Run as administrator and enter
cipher /x backup_e
(After exporting, it will prompt to save the created file and also generate an encrypted certificate file.)
Check the restore point:
- If your system has used Windows System Restore Points, these points may also contain certificate and key data.
- Restore method:
Open Startup Menu -> Recovery -> Open System Restore on an existing system.
Find an older restore point and export the data.
Letting go of encrypted files
If the key or any backup cannot be found, the file may be lost forever.Windows EFS uses a strong encryption design that makes decryption next to impossible without the key.
Tips for the next time encryption is enabled:
- Always back up your certificate and key:
Each time you use EFS to encrypt a new file, new keys are generated, so you need to back up these keys.
- Use EFS encryption with caution:
If you are not familiar with EFS or use it for personal use, consider using other backup and encryption tools (e.g. WinRAR, 7-Zip's encryption, BitLocker, VeraCrypt).
- Store important data and system partitions separately:
Avoid storing system files and important data in the same partition to reduce formatting risk
Best Wish
Shawn.Z-MSFT | Microsoft Community Support Specialist