Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
Change error message when decryption fails
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Jan 11, 2024
1 parent cb836d4 commit 3094beb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ All notable changes to this project will be documented in this file.
The format is based on https://keepachangelog.com/[Keep a Changelog], and this
project adheres to https://semver.org/[Semantic Versioning].

== {compare-url}/v0.7.7\...HEAD[Unreleased]

=== Changed

* Change the error message when decryption fails ({pull-request-url}/408[#408])

== {compare-url}/v0.7.6\...v0.7.7[0.7.7] - 2024-01-07

=== Changed
Expand Down
6 changes: 2 additions & 4 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,11 @@ pub fn run() -> anyhow::Result<()> {
c @ Err(ScryptencError::InvalidHeaderMac(_)) => {
c.context("passphrase is incorrect")
}
c => c.with_context(|| {
format!("the header in {} is invalid", arg.input.display())
}),
c => c.context("the header in the encrypted data is invalid"),
}?;
let plaintext = cipher
.decrypt_to_vec()
.with_context(|| format!("{} is corrupted", arg.input.display()))?;
.context("the encrypted data is corrupted")?;

if let Some(file) = arg.output {
output::write_to_file(&file, &plaintext)?;
Expand Down

0 comments on commit 3094beb

Please sign in to comment.