Create a Public/Private Key pair on MS Windows

From sokwedb
Jump to navigation Jump to search

The following steps create a public/private key pair (a digital identity) on Microsoft Windows:

  • Supply your name and address. Type the following into the terminal window and press the "Enter" key, substituting your name and email in the requisite spot. If you make a mistake, type it again.
$NAME_EMAIL="First Last <myself@example.com>"
  • Show your digital identity (the public key half), creating an identity if it does not exist. Cut and paste the following block of commands into the terminal window. Press the "Enter" key after pasting.
if (!(Test-Path -Path $HOME\.ssh)) {
  New-Item -Path $HOME\.ssh -ItemType Directory
}
if (!(Test-Path -Path $HOME\.ssh\id_ed25519)) {
  ssh-keygen.exe -t ed25519 -f $HOME\.ssh\id_ed25519 -a 100 -C ${NAME_EMAIL} -N '""'
}

Your terminal window will afterward contain text similar to this:

Your identification has been saved in C:\Users\myself\.ssh\id_ed25519
Your public key has been saved in C:\Users\myself\.ssh\id_ed25519.pub
The key fingerprint is:
SHA256:RS/EcUuHR8w75KpvXoWj/2xNzMBnkAMhFYImOQMLUes First Last <myself@example.com>
The key's randomart image is:
+--[ED25519 256]--+
|  ooo. . o*oBOo. |
|   . o= oo.*.oO  |
|    o  =  o o= + |
|   .     . .  *.o|
|    E   S    .oB.|
|            .. o+|
|           .. ...|
|          . .o .o|
|           +o .oo|
+----[SHA256]-----+

Lastly, cut and paste the following text and press the "Enter" key:

type $HOME\.ssh\id_ed25519.pub

The output from should look similar to this:

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEay3Ro8xHXJrxfDbhm5jUSqZ3tHjXLBzhcLbIaVwNIT First Last <myself@example.com>

That long line beginning with "ssh-ed25519" and ending with your name and email is your public key. You're going to copy and paste the whole line into an email in the step after next.


Back to the VPN Setup page