jeroen / openssl

OpenSSL bindings for R
Other
65 stars 23 forks source link

Parse new openssh private key format #66

Closed jeroen closed 5 years ago

jeroen commented 5 years ago

Recent versions of openssh are using a new format for private keys:

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABAnG3jyNb
SKSG19wHPhx2U1AAAAEAAAAAEAAAEXAAAAB3NzaC1yc2EAAAADAQABAAABAQDtmnNl2AFg
9faMuZ/U38tY3+pDrOa2yoiOLeXQI3044xNiMiGrRW03wzWsaNCcI8ZnEeSvzr2HUq0YFQ
QQ6MaQp8cZmoGkOSnwhLAscocZOaoZwoj85w2hybuSy9fc99FqKbJ201a0++2BhTw4Syhs
LT3AOs+Z0hHXZEVWAfBsOd4icLnChBdEAsIBzEObdGsZXHiOcVgvcbJ7UOuQCkiJV3RX+P
IvTzivPQ8IGmsgYUj5KSPjZg03/tr3ePItuFQZH2p85dQlbOLyhtMpx6M5ErCAesxuTN6z
kHKtfRNfYXoDOgd5EBIc9hLnmQtpn2EjfIk+yW+yTiv0pwNUhoeFAAAD0BHcM21NrYK7Pu
C4m79CfD3ZRMdKzG+hUqrV6bRC8qK/iTnt/E4GvEOIOqqoQMQp7PLRP5CkeWRp4Y0nmpsP
zoSlVLvpJ1o36pSSpF6ClmsviAXjujB4wqOp+vq9KqfQfJT+khq4u2EaKwzclpfwaUe2lT
t/UdUok4n8BGVZl6Hw3vF+a8XWpM3ZWxFJXNaQ1bklfYraKDR483I2KJX/hT1Y+Shrl7hd
faqfI8A71lV7qYwqyEMBgwsbNzDYUpICwAEGp00pbX7ahBgo3OIL8Ay1LTbVRyZqMZGGSy
Ay4+WD5cgzU1sb7Z7XnKeRdEWyYUezvzDLpwYsx5RjXIDECBOwbRexh0X0taJw9MIS1YtV
dXz+8PRelQSn7jMHTLa1ILhF95KQBBnqN8EAZEXPnX50b6tz1y7/U1PR/+OxaEGX960m25
2WoXfSRraA6lA2b28r4NT2/BWfYg+6RVu9AQOwdZNWs1fU4ZwnN3yf2w+xEJvvnrXFJrIv
Hy6riJOIB9kSFI314vqmipsMpm7eJK7S3TCi8O6npfkhKTsU1rK4MW+gYp3LKTa2/eUy9r
Rfdgg3dZfq4e51th/9g6SCfrLaDhqTVf7AThOSlmqIpW2A1+4WmuSqhplZhZV5QA0Dyg26
mPHMFTIKs6P2dzgqTkfFxpEici6BeTiSBuMjeKau2HI8r6VD8fcpkvcARPHncoZAdQbars
+e9FhyNMY+EVzun95FUjlbSAFCjGUN81/XPAd+PERTtg+Z1h+QEb1jlZO6l+L62SYXZQO7
jZa3euvFTUxh4GAuWMF4SM7HibTrnY3POD4y8pIWWFsS6xbDQPcy1BdgS4A4IeAXNFbFsX
U7xAwiA0QOnF2Qwc6rTIfR8KiDJ2pMPuSF3CsvuX1VuJZ4EvUFXImBAmet5ChXA2Gw2Gkf
vItgB70xjRVJUjqOE1FE8Qb61BWEvH9pQMIHt59ldrcnLycOFmBIvWiCLyEb5s+asMsqui
GoMowxdmaM+tkNsJIWFqKviaqHL51ZxzWfZ5C8RIrC1bBjCPdHd+T6iQifNS1vJhgEPuG/
iI9R2aFMdz69CVnWJzhtTEvJFsBNiM1rKTXXFm00rCZozKM6xVaiDodgL5s3FxVr17WTMH
FaFMCH7JNAJMCR7080IuABHFubE2UyeCV6WxUgDpeGzLGOLXmLlrpyB5DHbkuNa8OohIDm
qW5yZcK4RoN1Foi4+tAs7qCJQAJBKFmwTc+5y6mQnq9s9jHQqBbyweHmK8VTHwiRpHbBv/
BQ3FL3t8pTZxv6msYq0+PUUZ3L8+k=
-----END OPENSSH PRIVATE KEY-----

Recent versions ssh-keygen seem to default to this format : https://github.com/ropensci/ssh/issues/24

jeroen commented 5 years ago

Looks like this will require some non standard bcrypt algo: https://github.com/openssh/openssh-portable/blob/master/openbsd-compat/bcrypt_pbkdf.c