api2/subscription.rs: add subscription api class

This commit is contained in:
Dietmar Maurer
2019-01-22 12:50:19 +01:00
parent 576e3bf252
commit 7e13b2d67f
3 changed files with 42 additions and 0 deletions

View File

@ -355,3 +355,16 @@ pub fn scandir<P, F>(
}
Ok(())
}
pub fn get_hardware_address() -> Result<String, Error> {
static FILENAME: &str = "/etc/ssh/assh_host_rsa_key.pub";
let mut file = File::open(FILENAME)?;
let mut contents = Vec::new();
file.read_to_end(&mut contents)?;
let digest = md5::compute(contents);
Ok(format!("{:0x}", digest))
}