Deleting old keys on Smart Card
If you use your smart card a lot and issue many certificates to your Smart Card there will be a moment when the storage on the card will get too small to accommodate new certificates. In most cases your IT department might ask you to send your card back for replacement or they will tell you to issue replacement certificates while reusing the same private key – too keep the size of new certificates on the card to a minimum.
But it is fairly easy to delete old certificates from your card and free up space on it.
Do delete certificate on Smart Card use the following command:
|certutil –delkey –csp "Microsoft Base Smart Card Crypto Provider" KeyContainerName|
Of course you need to know KeyContainerName before you can run above command.
To find the right container name on the card you can run the following command:
certutil –key –csp "Microsoft Base Smart Card Crypto Provider"
This command will show container names, but it will not show associated certificates with containers.
To list all certificates on the card use the following command:
Make sure to find container corresponding to expired certificate that you want to remove from Smart Card. If you specify wrong container it will delete valid certificate and your card will become useless and then you’ll definitively have to contact help desk.
Here is an example of the “certutil –key –csp "Microsoft Base Smart Card Crypto Provider"” output:
C:\>certutil -key -csp "Microsoft base Smart Card Crypto Provider"
Microsoft base Smart Card Crypto Provider:
le-MSSmartcardUser-02c869ab-c62d--61905 [Default Container]
CertUtil: -key command completed successfully.