Generating a self-signed certificate PFX file with Powershell

Sometimes you need a self-signed SSL certificate for an internal project, but perhaps you’re restricted from using a 3rd party tool such as OpenSSL. Maybe this is for security reasons, a lack of external internet connectivity, or maybe you’re just working on something small and you need a quick solution. Well, Microsoft has you covered, as the ability to self-sign a certificate in Windows is quite simple.

Open a Powershell Command Line as an Administrator, then enter the following command (changing “computerhostname” to the hostname of the server the file will reside on, using the FQDN (ex. computername.local) if you can):
New-SelfSignedCertificate -DnsName “computerhostname” -CertStoreLocation “cert:\LocalMachine\My”

Then, Windows Key+R to open the run menu, type certlm.msc and press enter or click OK. This will open the Certificate Manager for the Local Machine.

To export the public and private certificate and key as a Private Information Exchange or PFX file (a Personal Information Exchange public/private key combo file) follow these steps:

  1. On the left side of Certificate Manager, expand “Personal” then click Certificates.
  2. Right click the certificate you just created, then click All Tasks, then Export.
  3. Next > YES > Next > leave the defaults (Personal Information Exchange, with “Include…” and “Enabled…” checked) > Next > Password (enter your desired password, which you will need later to use the PFX file), change the Encryption to AES256-SHA256 > Next > Browse and give the PFX file a destination and a name (demo.pfx) > Next > Finish > OK.

How to create PEM and PFX Certificates and Keys with OpenSSL

OpenSSL has become THE standard for generating certificates for casual needs. Here’s how quickly you can create your own self-signed certificate and and a cert/key. Whether you need a .PEM, .CER, .Key, or .PFX, this article has you covered.

  1. Open an elevated command prompt as Administrator.
  2. Browse to C:\Program Files’OpenSSL-Win64\bin or C:\Program Files (x86)\OpenSSL-Win32\bin (or wherever you installed OpenSSL).
  3. openssl genrsa -aes256 -out demo.key 4096
  4. openssl rsa -in demo.key -out demo.key
  5. openssl req -new -x509 -nodes -sha512 -key demo.key -out demo.crt -days 3650

In step 3, you can use 2048 bits on slower machines, or 4096 bits for higher security. These days most anything can handle higher bit encryption, so I just stick with 4096. In the screenshot you’ll see I used SHA1 in step 5, but you can use SHA512 for additional security as it is fully supported nearly anywhere you’re going to use these certificates in 2024 and beyond.

In Step 5, you can replace “.key” and “.crt” with “.pem” if you prefer, the file will still be compatible.

Also in step 5, you can specify a number of days – since this certificate is self-signed it can be anything you want. 365 for one year, 3650 for 10 years, or even 36500 for a 100 year certificate!

After you press enter, it will ask a series of questions that should be simple to answer. When it asks for server name or FQDN, it’s best to enter the local machine name you’ll be using the certificate on (ex. computername.local).

The result will be a pair of files in the “bin” folder from step 2! You should be able to upload these and use them wherever you need them!

But what about PFX files?

If you also need a PFX file (a Personal Information Exchange public/private key combo file which can be more easily shared) you can generate one with one, simple additional command:
Step 6: openssl pkcs12 -export -out demo.pfx -inkey demo.key -in demo.crt

This will prompt you for a password that you will need to remember in order to use the PFX file in its final place.

Robo & Kala 2 in 1 Laptop Review

Back in September, I purchased the Robo & Kala 2 in 1 Laptop. I was looking for tablet that specifically ran Windows. Unfortunately, Windows tablets are few and far between, and those that exist are quite underpowered. That’s not to say that this device is a powerhouse, and we’ll talk about that more in a moment. But I was about to travel internationally for the first time in many years, and I was looking for a laptop that met two important requirements: battery life, and lightweight.

Continue reading “Robo & Kala 2 in 1 Laptop Review”

What my energy bill looks like with Time of Use Billing

Got my first full-month electric bill using “Time of Use” billing for electricity. I don’t have a family at home using electricity during the day, so I had that in my favor. Some evenings I might need to do a load of laundry (electric dryer) or cook (electric stove top & oven), etc., but for the most part I’m either still at work or out of the house most of the hours when the “peak” billing rate is happening.

Throughout October I barely had to run the air conditioning, but I did run the blower fan almost every night, all night, to circulate air.

I put the car on a schedule to charge after 11PM. It’s always done before 6 AM, even when I’m below 10% to start.

My first full month of “Time of Use” billing was $86.01. Compare directly to October of ’22 when it was $50.96 without an electric car to charge.

I didn’t have the electric car last year. That saves me $250 in fuel costs. My new monthly combined total is over $200 LOWER than last year!

I paid $30 more in electricity than I did last October, but I drove my car 70 miles a day 5 days a week, and bought $0 in gas (petrol)!