pub fn parse_pem_privkey(pem: &[u8], passphrase: Option<&str>) -> OsshResult<KeyPair> {
    let pkey = if let Some(passphrase) = passphrase {
        PKey::private_key_from_pem_passphrase(pem, passphrase.as_bytes())
            .map_err(|_| ErrorKind::IncorrectPass)?
    } else {
        PKey::private_key_from_pem(pem)?
    };

    KeyPair::from_ossl_pkey(&pkey)
}
//TODO: Not to depend on openssl to parse pem file in the future
Not to depend on openssl to parse pem file in the future
Not to depend on openssl to parse pem file in the future
pub fn parse_pem_privkey(pem: &[u8], passphrase: Option<&str>) -> OsshResult<KeyPair> {
    let pkey = if let Some(passphrase) = passphrase {
        PKey::private_key_from_pem_passphrase(pem, passphrase.as_bytes())
            .map_err(|_| ErrorKind::IncorrectPass)?
    } else {
        PKey::private_key_from_pem(pem)?
    };
    KeyPair::from_ossl_pkey(&pkey)
}
pub fn parse_pem_privkey ( pem : & [ u8 ] , passphrase : Option < & str > ) -> OsshResult < KeyPair > { let pkey = if let Some ( passphrase ) = passphrase { PKey :: private_key_from_pem_passphrase ( pem , passphrase . as_bytes ( ) ) . map_err ( | _ | ErrorKind :: IncorrectPass ) ? } else { PKey :: private_key_from_pem ( pem ) ? } ; KeyPair :: from_ossl_pkey ( & pkey ) }
TODO: Not to depend on openssl to parse pem file in the future
TODO : Not to depend on openssl to parse pem file in the future
pem
&[u8]
passphrase
Option<&str>
pem
&[u8]
passphrase
Option<&str>