Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

How the windows certificate store and its certificates work?

$
0
0

Hello,

I want to build a software App to use the certificate for data encryption.

I used Makecert.exe to create a certificate and use my App to install it in the windows certificate storelocalmachine\personal with the private key.

However in the low version of my App I made a mistake that this certificate cannot do data encryption, only can sign the software.

So I used Makecert.exe again to create a new certificate which can do data encryption, andwith the same name as the old one.

Then I modified my App to remove the old one from windows certificate store localmachine\personal and install the new one.

However I found when the work of removing the old and installing the new one, my App can not use the new certificate for data encryption, because I used a 3rd party software module to do the data encryption I cannot get the error info.

But when I manually removed the old cert and install the new one, everything is OK.

Why? what is the problem?

My source code is like this below:

       // remove the old one

X509Storestore = newX509Store(storeName, StoreLocation.LocalMachine);store.Open(OpenFlags.ReadWrite);store.Remove(certificate2);store.Close();

// install the new one

store = newX509Store(storeName, StoreLocation.LocalMachine);store.Open(OpenFlags.ReadWrite);if (!flag) {store.Add(certificate); }store.Close();

Thanks!

Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>