Fix data decrypt error, and seldom nonce decode problem

This commit is contained in:
timvisee 2018-03-20 22:36:56 +01:00
parent 9eb9462c40
commit 4957c98f6d
No known key found for this signature in database
GPG key ID: 109CBA0BF74036C2
3 changed files with 3 additions and 3 deletions

View file

@ -115,7 +115,7 @@ impl<'a> Download<'a> {
// Get the metadata nonce
// TODO: don't unwrap here, return an error
let nonce = b64::decode_url(
let nonce = b64::decode_standard(
response.headers()
.get_raw(HEADER_AUTH_NONCE)
.expect("missing authenticate header")

View file

@ -25,5 +25,5 @@ pub fn decode_url(input: &str) -> Result<Vec<u8>, DecodeError> {
/// Decode the given string as base64, with the standaard character set.
pub fn decode_standard(input: &str) -> Result<Vec<u8>, DecodeError> {
decode(input, base64::STANDARD_NO_PAD)
decode(input, base64::STANDARD)
}

View file

@ -502,7 +502,7 @@ impl Write for EncryptedFileWriter {
}
// Compute how many bytes were written
Ok(file_bytes - file_buf.len() + min(tag_buf.len(), tag_bytes))
Ok(file_buf.len() + tag_buf.len())
}
fn flush(&mut self) -> Result<(), io::Error> {