Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
369 changes: 192 additions & 177 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repository = "https://github.com/sorairolake/scryptenc-rs"

[workspace.dependencies]
anyhow = "1.0.100"
clap = { version = "4.5.50", features = ["derive"] }
clap = { version = "4.5.51", features = ["derive"] }
dialoguer = { version = "0.12.0", default-features = false, features = [
"password",
] }
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ path = "src/main.rs"
anyhow.workspace = true
byte-unit = "5.1.6"
clap = { workspace = true, features = ["wrap_help"] }
clap_complete = "4.5.59"
clap_complete_nushell = "4.5.9"
clap_complete = "4.5.60"
clap_complete_nushell = "4.5.10"
dialoguer.workspace = true
fraction = { version = "0.15.3", default-features = false }
jiff = { version = "0.2.15", default-features = false, features = ["std"] }
Expand All @@ -36,7 +36,7 @@ sysinfo = "0.36.1"
thiserror = "2.0.17"

[dev-dependencies]
assert_cmd = "2.0.17"
assert_cmd = "2.1.1"
predicates = "3.1.3"

[features]
Expand Down
4 changes: 2 additions & 2 deletions crates/cli/tests/utils/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
//
// SPDX-License-Identifier: GPL-3.0-or-later

use assert_cmd::Command;
use assert_cmd::{Command, cargo::cargo_bin_cmd};

pub fn command() -> Command {
let mut command = Command::cargo_bin("rscrypt").unwrap();
let mut command = cargo_bin_cmd!("rscrypt");
command.current_dir("tests");
command
}
3 changes: 3 additions & 0 deletions crates/scryptenc/src/decrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#[cfg(feature = "alloc")]
use alloc::vec::Vec;

#[allow(deprecated)]
use aes::cipher::{KeyIvInit, StreamCipher, generic_array::GenericArray};
use hmac::Mac;

Expand Down Expand Up @@ -65,6 +66,7 @@ impl<'c> Decryptor<'c> {
header.verify_mac(&dk.mac(), ciphertext[64..HEADER_SIZE].into())?;
let (ciphertext, mac) =
ciphertext[HEADER_SIZE..].split_at(ciphertext.len() - HEADER_SIZE - TAG_SIZE);
#[allow(deprecated)]
let mac = *HmacSha256Output::from_slice(mac);
Ok(Self {
header,
Expand Down Expand Up @@ -115,6 +117,7 @@ impl<'c> Decryptor<'c> {

buf.copy_from_slice(decryptor.ciphertext);

#[allow(deprecated)]
let mut cipher = Aes256Ctr128BE::new(&decryptor.dk.encrypt(), &GenericArray::default());
cipher.apply_keystream(buf);
let data = [&decryptor.header.as_bytes(), decryptor.ciphertext].concat();
Expand Down
2 changes: 2 additions & 0 deletions crates/scryptenc/src/encrypt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#[cfg(feature = "alloc")]
use alloc::vec::Vec;

#[allow(deprecated)]
use aes::cipher::{KeyIvInit, StreamCipher, generic_array::GenericArray};
use hmac::Mac;
use scrypt::Params;
Expand Down Expand Up @@ -124,6 +125,7 @@ impl<'m> Encryptor<'m> {
let body = &mut buf[bound.0..bound.1];
body.copy_from_slice(encryptor.plaintext);

#[allow(deprecated)]
let mut cipher = Aes256Ctr128BE::new(&encryptor.dk.encrypt(), &GenericArray::default());
cipher.apply_keystream(body);
let mac = compute_mac(&buf[..bound.1], &encryptor.dk.mac());
Expand Down
2 changes: 2 additions & 0 deletions crates/scryptenc/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,9 @@ impl DerivedKey {
/// Creates a new `DerivedKey`.
#[inline]
pub fn new(dk: [u8; Self::SIZE]) -> Self {
#[allow(deprecated)]
let encrypt = *Aes256Ctr128BEKey::from_slice(&dk[..32]);
#[allow(deprecated)]
let mac = *HmacSha256Key::from_slice(&dk[32..]);
Self { encrypt, mac }
}
Expand Down
2 changes: 2 additions & 0 deletions crates/scryptenc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ mod params;
use aes::Aes256;
use ctr::Ctr128BE;
pub use hmac;
#[allow(deprecated)]
use hmac::{
Hmac,
digest::{Output, generic_array::GenericArray, typenum::U32},
Expand Down Expand Up @@ -131,5 +132,6 @@ type HmacSha256 = Hmac<Sha256>;
/// A type alias for output of HMAC-SHA-256.
type HmacSha256Output = Output<HmacSha256>;

#[allow(deprecated)]
/// A type alias for key of HMAC-SHA-256.
type HmacSha256Key = GenericArray<u8, U32>;
4 changes: 2 additions & 2 deletions crates/wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ crate-type = ["cdylib", "rlib"]
[dependencies]
getrandom = { version = "0.2.16", features = ["js"] }
scryptenc = { path = "../scryptenc", version = "0.10.0" }
wasm-bindgen = "0.2.100"
wasm-bindgen = "0.2.105"

[dev-dependencies]
wasm-bindgen-test = "0.3.50"
wasm-bindgen-test = "0.3.55"

[lints]
workspace = true
2 changes: 1 addition & 1 deletion crates/wasm/deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"imports": {
"@cliffy/command": "jsr:@cliffy/command@^1.0.0-rc.8",
"@std/cli": "jsr:@std/cli@^1.0.22",
"@std/cli": "jsr:@std/cli@^1.0.23",
"@std/io": "jsr:@std/io@^0.225.2"
}
}
15 changes: 11 additions & 4 deletions crates/wasm/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.