Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Character-set of SSH keys (safe delimiter for using sed with public keys)

Tags:

ssh

sed

I am using sed to replace a placeholder in a script with my public ssh key. The character / is definitely present in some SSH keys, how can I find out which character I can use as delimiter for sed?

I am looking for an answer of either the set of all characters that can be part of the string generated by ssh-keygen, or which characters are guaranteed not to.

like image 542
P.R. Avatar asked Aug 08 '16 12:08

P.R.


1 Answers

The public key in opnessh format is base64-encoded as mentioned for example in the manual page for sshd. Therefore you can use any character that is not in the list of base64 characters. The / is there but for example | can be used safely (though in the comment section can be anything).

like image 186
Jakuje Avatar answered Oct 22 '22 06:10

Jakuje