Check for private key when encryption is set

pull/10/head
Dennis Schwerdel 2017-04-08 10:04:12 +02:00 committed by Dennis Schwerdel
parent a02a0a7c7f
commit 289a412a12
2 changed files with 3 additions and 1 deletions

View File

@ -12,7 +12,6 @@
## Usability
* Verbosity control
* Check for private key when encryption is set
* Display backup name and path on backup integrity error
* Better control over what is checked in `check` subcommand
* Nice error when remote storage is not mounted

View File

@ -167,6 +167,9 @@ impl Repository {
#[inline]
pub fn set_encryption(&mut self, public: Option<&PublicKey>) {
if let Some(key) = public {
if !self.crypto.lock().unwrap().contains_secret_key(key) {
warn!("The secret key for that public key is not stored in the repository.")
}
let mut key_bytes = Vec::new();
key_bytes.extend_from_slice(&key[..]);
self.config.encryption = Some((EncryptionMethod::Sodium, key_bytes.into()))