Description
When parsing a public key file with load_public_key(path), the key's comment is not returned in the final PublicKey struct.
Steps To Reproduce
- Create a keypair with a comment, e.g.
ssh-keygen -t ed25519 -C "my comment" -f keypair
- Dump key information with appropriate functions (see sample code).
- Observe error.
Sample Code
fn main() {
let key = load_public_key("./keypair.pub").unwrap();
println!("Key Type: {}", key.algorithm().to_string());
println!("Key Bytes: {}", key.to_string());
println!("Key Comment: {} (empty: {})", key.comment().to_string(), key.comment().is_empty());
println!("\nEncoded Key Format:\n\t{}", key.to_openssh().unwrap());
}
Sample Execution
➜ debug git:(master) ✗ ssh-keygen -t ed25519 -C "my comment" -f keypair
Generating public/private ed25519 key pair.
[ snip ]
➜ debug git:(master) ✗ ./russh-demo
Key Type: ssh-ed25519
Key Bytes: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILgm39eVWrPRMq8Kl07z6GFZyfXD4FdVcelOEdH0PVGc
Key Comment: (empty: true)
Encoded Key Format:
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILgm39eVWrPRMq8Kl07z6GFZyfXD4FdVcelOEdH0PVGc
➜ debug git:(master) ✗ cat keypair.pub
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILgm39eVWrPRMq8Kl07z6GFZyfXD4FdVcelOEdH0PVGc my comment
Expected Results
The comment should be present in both key.comment() as well as in the re-encoded .to_openssh() method.
Actual Results
The comment appears to never be parsed.
Other Notes
A similar phenomenon can also be seen with AgentClient<?>.request_identities(). In that case, however, the returned AgentIdentity will populate the comment, but the underlying public_key is still missing it.
Description
When parsing a public key file with
load_public_key(path), the key's comment is not returned in the finalPublicKeystruct.Steps To Reproduce
ssh-keygen -t ed25519 -C "my comment" -f keypairSample Code
Sample Execution
Expected Results
The comment should be present in both
key.comment()as well as in the re-encoded.to_openssh()method.Actual Results
The comment appears to never be parsed.
Other Notes
A similar phenomenon can also be seen with
AgentClient<?>.request_identities(). In that case, however, the returnedAgentIdentitywill populate the comment, but the underlyingpublic_keyis still missing it.