RemoveCertificate
Description: | Removes a certificate from a certificate store. |
Returns: | Integer. Zero for success or a system error code. |
Usage: | Script Only. |
Function Groups: | Certificates |
Related to: |
AddCertificate | CheckCertificateChain | FindCertificate | GetCertificateInfo | ListCertificates | MakeSelfSignedCertificate | SetCertificateProperty |
Format: | RemoveCertificate(MachineStore, StoreName, Thumbprint) |
Parameters: |
MachineStore |
Required Boolean. If TRUE (non-zero), attempts to remove the certificate from a store in the Local Computer certificate hive. If FALSE (zero) attempts to remove the certificate from a store in the Current User certificate hive. |
StoreName |
Required text. The name of the store from which to remove the certificate. |
Thumbprint |
Required. A binary buffer holding the SHA1 thumbprint of the certificate to remove. |
Comments |
A SHA1 thumbprint is used as the certificate identification to ensure that the certificate is uniquely identified and the intended one is removed. You can obtain the SHA1 thumbprint of a certificate from a number of other certificate statements. For example, AddCertificate returns a SHA1 thumbprint and a thumbprint can be found in the certificate information structure returned from ListCertificates, GetCertificateInfo or FindCertificate. Thumbprints are convenient, compact values that can be persisted and used again later. |
Example:
RemoveCertificate(FALSE, "My", CertificateInfo.SHA1Thumbprint);
This will attempt to remove a certificate identified by the SHA1Thumbprint in structure CertificateInfo from the Personal store in the current user’s certificate hive.