I am using public/private key pairs for a long time now. And nearly the same time I'm asking myself over and over again, which file extension I should use. It seems to be that at least for the public and the private(openssh) keys is no convention at all?
I mean in PuTTy there is a special extension .ppk
for "PuTTy Private Key" and the public key is stored either without an extension, or with .pub
. I personally prefere not to use .pub
, because Microsoft is using this extension already for MS Publisher. So for PuTTy I store both keys with the same name and add .ppk
to the private and nothing to the public key. And for that case I can live with that. I can identify which key is the public and which the private one and that the private one is for PuTTy only.
But what should I do with the private openssh key? Just store it without an extension? Or use something like .openssh
? Also if there is no convention really, if someone just thought about that and sorted out some sort of concept for himself, I would also appreciate that…
Thanks in advance!
Best Answer
First off, there really is no official convention for naming keys. They filenames don't matter. They are only important to you, who has to manage them. The software is only concerned with the content of files.
That being said, OpenSSH key files are just text files, so you could name them with a
.txt
extension.I typically just stick with the convention that the
ssh-keygen
tool uses, which isid_{key_algorithm}
(ie.id_rsa
orid_dsa
) for the private key and then the private key name +.pub
for the public key (id_rsa.pub
orid_dsa.pub
). If I need to keep multiple keys I will add an additional identifier to the end of the name so I would get names likeid_rsa_myhost
andid_rsa_myhost.pub
.