mirror of
https://github.com/veeso/termscp.git
synced 2026-09-17 09:35:57 -07:00
build(deps): update aes-gcm to 0.11
CI / toolchain (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / install-scripts (push) Has been cancelled
Install.sh / build (macos-latest) (push) Has been cancelled
Install.sh / build (ubuntu-latest) (push) Has been cancelled
Site / build-site (push) Has been cancelled
CI / crates-macos-latest (push) Has been cancelled
CI / crates-ubuntu-latest (push) Has been cancelled
CI / crates-windows-latest (push) Has been cancelled
CI / doc (push) Has been cancelled
CI / deny (push) Has been cancelled
CI / toolchain (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / install-scripts (push) Has been cancelled
Install.sh / build (macos-latest) (push) Has been cancelled
Install.sh / build (ubuntu-latest) (push) Has been cancelled
Site / build-site (push) Has been cancelled
CI / crates-macos-latest (push) Has been cancelled
CI / crates-ubuntu-latest (push) Has been cancelled
CI / crates-windows-latest (push) Has been cancelled
CI / doc (push) Has been cancelled
CI / deny (push) Has been cancelled
Migrate nonce generation and parsing to the aes-gcm 0.11 API while preserving the encrypted payload format.
This commit is contained in:
Generated
+742
-1171
File diff suppressed because it is too large
Load Diff
+3
-4
@@ -10,7 +10,6 @@ keywords = ["terminal", "ftp", "scp", "sftp", "tui"]
|
||||
license = "MIT"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/veeso/termscp"
|
||||
rust-version = "1.98.0"
|
||||
description = "termscp is a feature rich terminal file transfer and explorer with support for SCP/SFTP/FTP/Kube/S3/WebDAV"
|
||||
|
||||
[package.metadata.rpm]
|
||||
@@ -37,9 +36,9 @@ smb-vendored = ["remotefs-smb/vendored"]
|
||||
|
||||
[dependencies]
|
||||
aes = "0.9"
|
||||
aes-gcm = "0.10"
|
||||
aes-gcm = "0.11"
|
||||
argh = "0.1"
|
||||
base64 = "0.22"
|
||||
base64 = "0.23"
|
||||
bitflags = "2"
|
||||
bytesize = "2"
|
||||
cbc = { version = "0.2", features = ["alloc"] }
|
||||
@@ -100,7 +99,7 @@ windows-native-keyring-store = "1"
|
||||
|
||||
[dev-dependencies]
|
||||
pretty_assertions = "1"
|
||||
serial_test = "3"
|
||||
serial_test = "4"
|
||||
|
||||
[build-dependencies]
|
||||
cfg_aliases = "0.2"
|
||||
|
||||
+5
-5
@@ -6,8 +6,8 @@
|
||||
|
||||
use aes::cipher::block_padding::Pkcs7;
|
||||
use aes::cipher::{BlockModeDecrypt, KeyIvInit};
|
||||
use aes_gcm::aead::{Aead, AeadCore};
|
||||
use aes_gcm::{Aes128Gcm, KeyInit, Nonce};
|
||||
use aes_gcm::aead::{Aead, Generate, Nonce};
|
||||
use aes_gcm::{Aes128Gcm, KeyInit};
|
||||
use base64::Engine;
|
||||
use base64::engine::general_purpose::STANDARD as B64;
|
||||
use md5::{Digest, Md5};
|
||||
@@ -20,7 +20,7 @@ const GCM_NONCE_LEN: usize = 12;
|
||||
pub fn aes128_b64_crypt(key: &str, input: &str) -> Result<String, CryptoError> {
|
||||
let derived = derive_gcm_key(key);
|
||||
let cipher = Aes128Gcm::new(&derived.into());
|
||||
let nonce_bytes = Aes128Gcm::generate_nonce(&mut aes_gcm::aead::OsRng);
|
||||
let nonce_bytes = Nonce::<Aes128Gcm>::generate();
|
||||
let ciphertext = cipher
|
||||
.encrypt(&nonce_bytes, input.as_bytes())
|
||||
.map_err(|_| CryptoError::AesGcm)?;
|
||||
@@ -51,11 +51,11 @@ fn decrypt_gcm(key: &str, secret: &str) -> Result<String, CryptoError> {
|
||||
return Err(CryptoError::InvalidData);
|
||||
}
|
||||
let (nonce_bytes, ciphertext) = raw.split_at(GCM_NONCE_LEN);
|
||||
let nonce = Nonce::from_slice(nonce_bytes);
|
||||
let nonce = Nonce::<Aes128Gcm>::try_from(nonce_bytes).map_err(|_| CryptoError::InvalidData)?;
|
||||
let derived = derive_gcm_key(key);
|
||||
let cipher = Aes128Gcm::new(&derived.into());
|
||||
let plaintext = cipher
|
||||
.decrypt(nonce, ciphertext)
|
||||
.decrypt(&nonce, ciphertext)
|
||||
.map_err(|_| CryptoError::AesGcm)?;
|
||||
String::from_utf8(plaintext).map_err(|_| CryptoError::InvalidData)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user