LocalHost Root CA is a straightforward PowerShell script designed to simplify the process of creating an SSL certificate for localhost and signing it with an existing root Certificate Authority (CA). This utility is particularly useful for developers and system administrators who need to set up local development environments with trusted SSL/TLS connections, avoiding browser warnings and ensuring secure local testing. The script generates a new certificate and exports it as a PFX file, ready for import into local certificate stores or web servers.
Built by: EliteSoftware Enterprises / Zachary Whiteman / Google Gemini AI.
This script provides a quick way to generate and sign localhost SSL certificates.
To run this script, you will need:
- Windows Operating System: (Windows 7 or later).
- PowerShell 5.1 or newer: This script uses PowerShell's built-in certificate management cmdlets.
- An Existing Root CA Certificate: A root CA certificate in
.cerformat must exist atC:\temp\WdpTestCA.cer. This CA will be used to sign the newly generatedlocalhostcertificate. - Administrator Privileges: The script implicitly requires Administrator privileges to import certificates into the local machine's certificate store.
- Download: Download the
LocalHostRootCA.PS1script file. - Unblock: Right-click the file, go to Properties, and click
Unblockif the file was downloaded from the internet. - Ensure Root CA: Place your root CA certificate named
WdpTestCA.ceratC:\temp\. - Review Configuration: Open the
.PS1script in a text editor and review/modify the following variables if needed:$IssuedTo: The DNS name for the certificate (defaults to "localhost").$Password: The password for the exported PFX file (defaults to "PickAPassword" - CHANGE THIS!).$OutputPath: The directory where the PFX file will be saved (defaults toc:\temp\).
- Run as Administrator: Open a PowerShell console as Administrator and execute the script:
.\LocalHostRootCA.PS1
After execution, the script will:
- Import the specified root CA certificate.
- Generate a new self-signed certificate for
localhost. - Sign the
localhostcertificate using your imported root CA. - Export the newly signed
localhostcertificate as a PFX file (e.g.,c:\temp\localhost.pfx) using the specified password.
You can then import this PFX file into your personal certificate store, or configure local web servers (like IIS, Apache, Nginx) to use it for trusted SSL/TLS connections for localhost.
- Simplified SSL Generation: Automates the creation of SSL certificates for
localhost. - CA-Signed Trust: Enables the generation of certificates signed by your own root CA, making them trusted within your local development environment.
- PFX Export: Provides the certificate in a widely compatible PFX format, including the private key for easy deployment.
- Customizable Output: Allows easy modification of the output path and PFX password.
The script is developed entirely in PowerShell, utilizing its robust certificate management capabilities:
- Scripting Language: PowerShell
- Certificate Cmdlets:
New-SelfSignedCertificate,Import-Certificate,Export-PfxCertificatefor certificate lifecycle management. - Security:
ConvertTo-SecureStringfor secure password handling during PFX export.
The LocalHostRootCA.PS1 script performs sensitive operations related to digital certificates on your local machine.
- Administrator Privileges: Modifying the local machine's certificate store requires elevated privileges. Ensure you run the script as Administrator.
- Password Management: The
$Passwordvariable for the PFX file is currently hardcoded in the script. It is highly recommended to change "PickAPassword" to a strong, unique password for any practical use. For production scenarios, consider using more secure methods for password handling (e.g., reading from a secure prompt). - Root CA Trust: The security of the generated
localhostcertificate is dependent on the security and trustworthiness of yourWdpTestCA.cerroot CA. - Local Storage: All generated files (PFX) are stored locally at the specified
$OutputPath. - No Telemetry: The script does not collect or transmit any user data or telemetry.
Distributed under the MIT License. See LICENSE.txt for more information.
Zach Whiteman - elitesoftwarecolimited@gmail.com
HuggingFace - https://huggingface.co/EliteSoftware
HuggingFace (Personal) - https://huggingface.co/TheShadyRainbow
LinkTree - https://linktr.ee/zachrainbow