impl PubKey for KeyPair {
fn push_to(&self, buffer: &mut CryptoVec) {
match self {
&KeyPair::Ed25519(ref key) => {
let public = &key.key[32..];
buffer.push_u32_be((ED25519.0.len() + public.len() + 8) as u32);
buffer.extend_ssh_string(ED25519.0.as_bytes());
buffer.extend_ssh_string(public);
}
#[cfg(feature = "openssl")]
&KeyPair::RSA { ref key, .. } => {
use crate::encoding::mpint_len;
let e = key.e().to_vec();
let n = key.n().to_vec();
buffer.push_u32_be((4 + SSH_RSA.0.len() + mpint_len(&n) + mpint_len(&e)) as u32);
buffer.extend_ssh_string(SSH_RSA.0.as_bytes());
buffer.extend_ssh_mpint(&e);
buffer.extend_ssh_mpint(&n);
}
}
}
}