Why is the id_rsa.pub file a .pub file?

Viewed 3010

The id_rsa.pub file is basically some encrypted text in the .ssh folder under the home folder in Linux and is used for public-key cryptography. It uses the .pub file format. But why does this file format also happen to be the file extension for Microsoft Publisher? Microsoft Publisher isn't involved with this kind of encryption in any way, so why does id_rsa.pub also use .pub? Also, how do computer program distinguish between these uses?

2 Answers

Nobody enforces file extension choices.

The file extension .pub was selected for a public key because it is short for public.

The file extension .pub was selected for a Microsoft Publisher document because it is short for Publisher.

That they conflict is unfortunate.

There is no central registry for file extensions, so many extensions are re-used by different applications.

A better system for figuring out 'what type is this file' is probably not an extension, but a mime-type. But because there's no standard way for a file to say 'I am this mimetype' and that information to be carried along with the file, systems end up using extensions for this and sometimes there's a collision.

Related