Import Private Keys

BobS

Distinguished
Apr 4, 2004
143
0
18,680
Archived from groups: microsoft.public.windowsxp.security_admin (More info?)

I need a way to import a private key pair from a PFX file from either a
script, or from a command line. Anybody have any suggestions.

Bob
 
Archived from groups: microsoft.public.windowsxp.security_admin (More info?)

BobS wrote:

> I need a way to import a private key pair from a PFX file from either
> a script, or from a command line. Anybody have any suggestions.
Hi

You can use the command line utility certmgr.exe for this, a
cryptoAPI/Authenticode tool from MS.

To add a certificate to the "Trusted Root Certification Authorities"
in localMachine:

certmgr.exe -add -c "<cert-file>" -s -r localMachine root

where <cert-file> is the path to the certificate file.


Current users personal certificate store command line:
http://groups.google.com/groups?selm=oCxuPcHjDHA.1772%40cpmsftngxa06.phx.gbl


Download certmgr.exe from:

Authenticode for Internet Explorer 5.0
http://www.microsoft.com/downloads/details.aspx?familyid=2b742795-d0f0-4a66-b27f-22a95fcd3425&displaylang=en


More information can be found here:

Certificate Manager Tool (Certmgr.exe)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cpgrfcertificatemanagertoolcertmgrexe.asp

Using CertMgr
http://msdn.microsoft.com/library/en-us/security/security/using_certmgr.asp



--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx