Self-signed certificate that lasts 5 years

by on Mar.02, 2022, under Computer Stuff, General Info, Windows Info

On modern Windows servers, you can create a self-signed certificate with powershell, using the new-selfsignedcertificate command. By default, this certificate will only last for 1 year before expiring. To create a certificate that lasts a little longer, fire up an admin powershell, and do this:

$fromtoday = get-date
$5years = $fromtoday.addyears(5)
new-selfsignedcertificate -dnsname mycertname.mydomainname.com -notafter $5years -certstorelocation cert:\localmachine\my

31
1
:,

1 Comment for this entry

  • Brian

    Pretty sure I know who thumbed this one down… :)
    Listen, I don’t fully explain everything I put here. Creating a self-signed cert that lasts 5 years is clearly not a good idea. I was only trying to show how easy it is to manipulate the expiration date of these, not suggest an insecure configuration.

Leave a Reply


Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

CryptedNets is proudly powered by

Entries (RSS) and Comments (RSS)
- Login

Visit our friends!

A few highly recommended friends...