Trait osshkeys::sshbuf::SshReadExt [−][src]
pub trait SshReadExt {
fn read_bool(&mut self) -> Result<bool>;
fn read_uint8(&mut self) -> Result<u8>;
fn read_uint32(&mut self) -> Result<u32>;
fn read_uint64(&mut self) -> Result<u64>;
fn read_string(&mut self) -> Result<Vec<u8>>;
fn read_utf8(&mut self) -> Result<String>;
fn read_mpint(&mut self) -> Result<BigNum>;
}
Expand description
io::Read extension to read ssh data
Required methods
Read a byte and convert it to boolean
By definition, all non-zero value would be interpreted as true.
fn read_uint8(&mut self) -> Result<u8>
fn read_uint8(&mut self) -> Result<u8>
Read a byte from the stream
fn read_uint32(&mut self) -> Result<u32>
fn read_uint32(&mut self) -> Result<u32>
Read 32 bits unsigned integer in big endian
fn read_uint64(&mut self) -> Result<u64>
fn read_uint64(&mut self) -> Result<u64>
Read 64 bits unsigned integer in big endian
fn read_string(&mut self) -> Result<Vec<u8>>
fn read_string(&mut self) -> Result<Vec<u8>>
Read bytes array or string
Before the binary string, there is a 32 bits unsigned integer to indicate the length of the data, and the binary string is NOT null-terminating.
Read UTF-8 string
This actually does the same thing as read_string() does. But it also convert the binary data to String.
fn read_mpint(&mut self) -> Result<BigNum>
fn read_mpint(&mut self) -> Result<BigNum>
Read multiple precision integer
Although it can contain negative number, but we don’t support it currently. Integers which is longer than 16384 bits are also not supporting.