Warm tip: This article is reproduced from stackoverflow.com, please click
c++ certificate windows private-key cryptoapi

Certmgr

发布于 2020-03-30 21:14:20

I am working with self-signed certificates and certificate manager of Windows OS.

First of all, I have created a self-signed certificate "RootCA" which has a private/public key pair assigned, nevertheless I have destroyed private key of this certificate with the next certutil.exe command succesfully:

certutil -user -delkey "RootCA"

Also, I have check refreshing and exporting private key and it is not possible, because it has been destroyed.

The problem is when I visualize "RootCA" in Certificate Manager after destroying private key, "General" tab indicates that "You have a private key that corresponds to this certificate.":

enter image description here

My question is:

Are there any way to update/remove previous certificate information? And if yes, is it possible to do it programmatically?

Questioner
Alberto Bricio
Viewed
64
Alberto Bricio 2020-01-31 18:14

With Microsoft CryptoAPI setting pvData parameter of CertSetCertificateContextProperty function to NULL solves the problem.