Domanda

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 ?

È stato utile?

Soluzione

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.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top