Skip to content

Instantly share code, notes, and snippets.

@CMCDragonkai
Last active January 15, 2018 19:25
Show Gist options
  • Save CMCDragonkai/01bd0524f88d0954e88f8743734ac05e to your computer and use it in GitHub Desktop.
Save CMCDragonkai/01bd0524f88d0954e88f8743734ac05e to your computer and use it in GitHub Desktop.
SSH: Conversions between OpenSSH Keys (Public/Private) and Putty Keys (PPK)
# it turns out that puttygen can do almost all conversions anyway
: '
ssh-private-public - Convert an openssh private key to an openssh public key
Usage: ssh-private-public <path-to-key> <path-to-key.pub>
'
ssh-private-public () {
ssh-keygen -f "$1" -y >"$2"
}
: '
ssh-private-ppk - Convert an openssh private key to a putty ppk
Usage: ssh-private-ppk <path-to-key> <path-to-key.ppk>
'
ssh-private-ppk () {
puttygen "$1" -O private -o "$2"
}
: '
ssh-ppk-public - Convert a putty ppk to an openssh public key
Usage: ssh-ppk-public <path-to-key.ppk> <path-to-key.pub>
'
ssh-ppk-public () {
puttygen "$1" -O public-openssh -o "$2"
}
: '
ssh-ppk-private - Convert a putty ppk to an openssh private key
Usage: ssh-ppk-private <path-to-key.ppk> <path-to-key>
'
ssh-ppk-private () {
puttygen "$1" -O private-openssh -o "$2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment