diff options
author | Katharina Fey <kookie@spacekookie.de> | 2017-12-15 13:47:16 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2017-12-15 13:47:16 +0100 |
commit | a5711348aeabb089f7da2c5951ba95562d0128a4 (patch) | |
tree | 7687a095236e9d1fde7cfa04178c2d2f46de72f1 /src/vault/mod.rs | |
parent | 9368787f0649a1ecb8f05da6610386c40c9c3e53 (diff) |
Using key utils. Doing further testing
Diffstat (limited to '')
-rw-r--r-- | src/vault/mod.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/vault/mod.rs b/src/vault/mod.rs index 70e0bb0..b7dd62d 100644 --- a/src/vault/mod.rs +++ b/src/vault/mod.rs @@ -19,6 +19,7 @@ use std::fs::File; use std::fs; use crypto::engine::CryptoEngine; +use crypto::key; use record::{Record, Payload}; use serde_json; @@ -79,17 +80,16 @@ impl Vault { pathbuf.push(format!("{}.vault", name)); /* Load the secret key */ - let mut key = String::new(); + // let mut key = String::new(); + let k: String; { pathbuf.push("primary.key"); let key_path = pathbuf.as_os_str(); - let mut key_file = File::open(key_path).unwrap(); - key_file.read_to_string(&mut key).expect( - "Failed to load primary key file!", - ); - }; + k = key::load_key(key_path); + } - let crypto = CryptoEngine::load_existing(&key, password); + println!("Existing key: {}", k); + let crypto = CryptoEngine::load_existing(&k, password); /* Load all existing records */ pathbuf.pop(); @@ -201,6 +201,8 @@ impl Vault { None => return ErrorType::FailedToInitialise, }; + println!("Primary key: {}", key); + /* Write encrypted key to disk */ { self.path.push("primary.key"); |