There are some common tasks about certificates. Let’s begin.
To access a system store and enumerate it:
To access a file system store (*.pfx) and enumerate certificates:
To load a single certificate from a file system store (*.pfx):
To export a X509Certificate2 object to a file store (*.pfx) (with private key and protected with a password):
To export only a public key of the X509Certificate2 to a file (*.cer):
And last but not least, if you have a certificate in Base64 form (for example from ADFS2 federation metadata), just create a blank text file with *.cer extension, copy the base64 certificate, save. The file can be used from within the Windows shell.
(a side note here: although most web sources claim that base64 encoded certificates in text form need the ----BEGIN CERTIFICATE----- preamble and -----END CERTIFICATE----- at the end, this is not necessary).
For example, a first googled certificate from here stored in a cert.cer text file
and double clicked from the OS shell opens up as