Disassociates certificate from private key and deletes physical private key material.
Remove-CertificatePrivateKey [-Certificate] <X509Certificate2[]> [<CommonParameters>]
Disassociates certificate from private key and deletes physical private key material. When you delete the certificate using Certificates MMC snap-in, certutil.exe command-line tool, or use Remove-Item cmdlet against Cert:\ PSDrive, only public part of the certificate is deleted and private key material is left on a system thus giving a false sense of destroyed key. This cmdlet ensures that the private key physical material is really destroyed. A PIN prompt may appear when private key is stored on a Smart Card or Hardware Security Module (HSM).
The function returns True if certificate has associated private key and the key was deleted. The function returns False if there is no associated private key.
Certificate object to delete private key material for.
Required? | True |
Position? | 0 |
Default value | |
Accept pipeline input? | True |
Accept wildcard characters? | False |
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, InformationAction, InformationVariable,
WarningAction, WarningVariable, OutBuffer, PipelineVariable and OutVariable.
For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216)
System.Security.Cryptography.X509Certificates.X509Certificate2
PS C:\> Get-Item Cert:\CurrentUser\My\D5643407CD9F4B9566FB6486E3B33C08713C191D | Remove-CertificatePrivateKey
Retrieves certificate with thumbprint 'D5643407CD9F4B9566FB6486E3B33C08713C191D' from currently logged on user personal store and deletes private key material.