Fix data decrypt error, and seldom nonce decode problem
This commit is contained in:
parent
9eb9462c40
commit
4957c98f6d
3 changed files with 3 additions and 3 deletions
|
@ -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")
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
Loading…
Add table
Reference in a new issue