Rejigger the SSHKey trait a little more cleanly.

This commit is contained in:
2019-04-04 19:51:03 -07:00
parent 68ddc7096b
commit e4f67f0918
4 changed files with 159 additions and 123 deletions

View File

@@ -1,11 +1,9 @@
use base64::DecodeError;
use simple_asn1::ASN1DecodeErr;
use std::io;
#[derive(Debug)]
pub enum SSHKeyParseError
{
ASN1Error(ASN1DecodeErr),
DecodeError(DecodeError),
IOError(io::Error),
NoBeginBannerFound, NoEndBannerFound,
@@ -23,13 +21,6 @@ pub enum SSHKeyParseError
InvalidPadding
}
impl From<ASN1DecodeErr> for SSHKeyParseError {
fn from(e: ASN1DecodeErr) -> SSHKeyParseError {
println!("asn1 error: {:?}", e);
SSHKeyParseError::ASN1Error(e)
}
}
impl From<DecodeError> for SSHKeyParseError {
fn from(e: DecodeError) -> SSHKeyParseError {
SSHKeyParseError::DecodeError(e)