Closed mplatts closed 1 year ago
I can't seem to get it to work. Not sure what I''m doing wrong.
iex(24)> file_path = Path.join([:code.priv_dir(:petal_pro), "static/repo", "public_key"])
iex(25)> public_key = File.read! file_path
iex(26)> :ssh.hostkey_fingerprint(public_key)
** (FunctionClauseError) no function clause matching in :ssh_message.ssh2_pubkey_encode/1
The following arguments were given to :ssh_message.ssh2_pubkey_encode/1:
# 1
"-----BEGIN RSA PUBLIC KEY-----truncated-----END RSA PUBLIC KEY-----\n\n"
ssh_message.erl:572: :ssh_message.ssh2_pubkey_encode/1
ssh.erl:799: :ssh.hostkey_fingerprint/1
Same happens for :ssh.hostkey_fingerprint(:sha256, public_key)
You need to decode the key first:
[pem_entry] = :public_key.pem_decode(public_key)
public_key = :public_key.pem_entry_decode(pem_entry)
That worked - thanks!
This might be a stupid question, but I've followed the guide here: https://hex.pm/docs/self_hosting and want to use the
--fetch-public-key
feature. The problem is, I don't know how to generate the fingerprint. I have a private and public key, but no fingerprint.