I'm currently running IIS on my server using an app instantiating certificates.
By doing this code, for instance :
X509Certificate2 myX509Certificate = new
X509Certificate2(Convert.FromBase64String(byteArrayRawCertificate), passwordCertificate,
X509KeyStorageFlags.Exportable |
X509KeyStorageFlags.MachineKeySet |
X509KeyStorageFlags.PersistKeySet);
The code works fine. But I encounter a problem on my computer, on the following folder :
C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys
3KB RSA files keep on being added on that folder. For now, I have more than a million files like those ones :
I would like to delete those files, but :
- IIS uses one of them for encryption of password, or perhaps for other purposes and I don't know which one,
Deleting such a large folder can take time (like days)
- Is there a simple way not to create those files again and again ? (if I don't mention "MachineKeySet" while instanciating my certificate, this won't work)
- If not, is there a way to remove the created files without deleting IIS ones ?
- Is there a way to detect which files are used by IIS ?
Thanks in advance for your help.