Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PfxImportOptions::named_no_persist_key() #97

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ironyman
Copy link

@ironyman ironyman commented Oct 11, 2023

This function sets PKCS12_NAMED_NO_PERSIST_KEY flag for PFXImportCertStore call to import pkcs12 file to prevent Windows from persisting the keys from the pkcs12 file to disk. Without this flag keys imported from pkcs12 files are saved to disk and need to be deleted manually (they are leaked usually).

The PKCS12_NAMED_NO_PERSIST_KEY flag requires a sufficiently new build of Windows so this change will try to use PKCS12_NAMED_NO_PERSIST_KEY if it's available and fall back to the leaky use of PFXImportCertStore if PKCS12_NAMED_NO_PERSIST_KEY is not available.

This fixes #98.

@steffengy
Copy link
Owner

Where's PKCS12_NAMED_NO_PERSIST_KEY documented?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PfxImportOptions::import() creates ncrypt key in file system that is not deleted when program exits
2 participants