I want to read .PFX certificate from Local Machine Store.

I use bellow code to read .CER file from store.

 X509Store store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);
            store.Open(OpenFlags.ReadOnly);
            X509Certificate2Collection certificateCollection = store.Certificates.Find(X509FindType.FindBySerialNumber, certificateSerialNo, true);
if (certificateCollection.Count == 1)
        {
           //Do something  
        }

So is their any way to read .PFX certificate from STORE ?

有帮助吗?

解决方案

It is my mistake. You can read .PFX certicicate as the same way as .CER,

So the Keypoints are.

  1. .PFX contaning both the key.
  2. In Order to import and export and read .PFX file from a folder in order to verify sign required "Password" of the .PFX file.
  3. In order to read .PFX file (Private key) from STORE not required any password.
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top