Add SSH host key parsing and conversion utilities
What does this MR do and why?
Contributes to #517970
Problem
The remote mirrors API needs to accept host keys from users and convert them into the ssh_known_hosts format used internally. There is no utility to extract key parts from SSH public key strings or to normalize host keys with proper hostname handling.
Solution
Add Gitlab::SSHPublicKey.extract_key_parts class method
that parses algorithm, prefix, and key data from SSH key
strings in both bare and known_hosts formats.
Add RemoteMirrors::HostKeysConverter model that converts
an array of host keys (bare or full known_hosts format)
into an ssh_known_hosts string, handling hostname
extraction from URLs, non-standard port bracketing,
form-encoded key sanitization, and validation.
References
Screenshots or screen recordings
Not applicable — backend only.
How to set up and validate locally
Not applicable — covered by unit tests.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.