mirror of
https://github.com/Noratrieb/cluelessh.git
synced 2026-01-14 16:35:06 +01:00
ecdsa private key
This commit is contained in:
parent
dcba4931e5
commit
1a093aa536
8 changed files with 147 additions and 28 deletions
|
|
@ -81,8 +81,15 @@ impl<'a> Reader<'a> {
|
|||
Ok(NameList(list))
|
||||
}
|
||||
|
||||
pub fn mpint(&mut self) -> Result<MpInt<'a>> {
|
||||
todo!("do correctly")
|
||||
pub fn mpint(&mut self) -> Result<&'a [u8]> {
|
||||
let mut s = self.string()?;
|
||||
|
||||
if s.first() == Some(&0) {
|
||||
// Skip the leading zero byte in case the number is negative.
|
||||
s = &s[1..];
|
||||
}
|
||||
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
pub fn string(&mut self) -> Result<&'a [u8]> {
|
||||
|
|
@ -152,6 +159,10 @@ impl Writer {
|
|||
self.u8(v as u8);
|
||||
}
|
||||
|
||||
pub fn current_length(&self) -> usize {
|
||||
self.0.len()
|
||||
}
|
||||
|
||||
pub fn finish(self) -> Vec<u8> {
|
||||
self.0
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue