keymgr: Move ssh-related functions out of EncodableKey.
EncodableKey
is supposed to be format-agnostic. This moves the
functionality related to OpenSSH encoding to the new SshEncodableKey
trait. This commit also removes the EncodableKey::to_bytes
function,
because not all keys have a canonical byte representation.
This a temporary solution for #965 (closed). It's not ideal, because users still
can't use KeyMgr
with custom key encoding formats (EncodableKey
needs to know all supported encoding formats ahead of time, and provide
an as_<custom_format>()
method for each of them).
In the long-term, we should consider providing some APIs to enable
Keystore
s to downcast &dyn EncodableKey
s to the appropriate
user-provided type/trait object.