Whenever I call the Load method of the ApplicationConfiguration class with StoryType equal to Directory a new file is generated in the directory "C:\ProgramData\Microsoft\Crypto\Keys", that is, whenever a new session is created with the server I have this behavior. Currently thousands of files have been created in this directory. I found a lot of material on the internet about this problem and, in the case of the SDK, it occurs in the LoadPrivateKey function of the DirectoryCertificateStore class every time a certificate is loaded. The code resposable for creating the file is bellow:
I think that per certificate only one private key file should be created or at least at some point the file should be deleted.
Steps To Reproduce
1) Open UA-Reference.sln
2) Run ConsoleReferenceClient project and connect to any server
3) Verify that everytime you connect to a server a new file is generated to "C:\ProgramData\Microsoft\Crypto\Keys" directory.
Environment
- OS: Windows 10
- Environment: VS 2022
- Runtime: net6.0
- Nuget Version:
- Component: Opc.Ua.Core
- Server: Any
- Client: ConsoleReferenceClient
Type of issue
Current Behavior
Whenever I call the Load method of the ApplicationConfiguration class with StoryType equal to Directory a new file is generated in the directory "C:\ProgramData\Microsoft\Crypto\Keys", that is, whenever a new session is created with the server I have this behavior. Currently thousands of files have been created in this directory. I found a lot of material on the internet about this problem and, in the case of the SDK, it occurs in the LoadPrivateKey function of the DirectoryCertificateStore class every time a certificate is loaded. The code resposable for creating the file is bellow:
An explanation I found on the internet... https://snede.net/the-most-dangerous-constructor-in-net/
Expected Behavior
I think that per certificate only one private key file should be created or at least at some point the file should be deleted.
Steps To Reproduce
1) Open UA-Reference.sln 2) Run ConsoleReferenceClient project and connect to any server 3) Verify that everytime you connect to a server a new file is generated to "C:\ProgramData\Microsoft\Crypto\Keys" directory.
Environment
Anything else?
No response