correctly implement SDA compatible decryption
This commit is contained in:
parent
8f6a1d8345
commit
02d8cade2a
2 changed files with 13 additions and 7 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -950,9 +950,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.10.33"
|
version = "0.10.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a61075b62a23fef5a29815de7536d940aa35ce96d18ce0cc5076272db678a577"
|
checksum = "549430950c79ae24e6d02e0b7404534ecf311d94cc9f861e9e4020187d13d885"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
@ -970,9 +970,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl-sys"
|
name = "openssl-sys"
|
||||||
version = "0.9.61"
|
version = "0.9.65"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "313752393519e876837e09e1fa183ddef0be7735868dced3196f4472d536277f"
|
checksum = "7a7907e3bfa08bb85105209cdfcb6c63d109f8f6c1ed6ca318fff5c1853fbc1d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"autocfg 1.0.1",
|
"autocfg 1.0.1",
|
||||||
"cc",
|
"cc",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use aes::Aes256;
|
use aes::Aes256;
|
||||||
use block_modes::block_padding::Pkcs7;
|
use block_modes::block_padding::NoPadding;
|
||||||
use block_modes::{BlockMode, Cbc};
|
use block_modes::{BlockMode, Cbc};
|
||||||
use log::*;
|
use log::*;
|
||||||
use ring::pbkdf2;
|
use ring::pbkdf2;
|
||||||
|
@ -10,7 +10,7 @@ use std::path::Path;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use steamguard::SteamGuardAccount;
|
use steamguard::SteamGuardAccount;
|
||||||
|
|
||||||
type Aes256Cbc = Cbc<Aes256, Pkcs7>;
|
type Aes256Cbc = Cbc<Aes256, NoPadding>;
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct Manifest {
|
pub struct Manifest {
|
||||||
|
@ -102,9 +102,15 @@ impl Manifest {
|
||||||
let key = get_encryption_key(&passkey.into(), ¶ms.salt)?;
|
let key = get_encryption_key(&passkey.into(), ¶ms.salt)?;
|
||||||
let iv = base64::decode(¶ms.iv)?;
|
let iv = base64::decode(¶ms.iv)?;
|
||||||
let cipher = Aes256Cbc::new_from_slices(&key, &iv)?;
|
let cipher = Aes256Cbc::new_from_slices(&key, &iv)?;
|
||||||
|
|
||||||
let mut ciphertext: Vec<u8> = vec![];
|
let mut ciphertext: Vec<u8> = vec![];
|
||||||
reader.read_to_end(&mut ciphertext)?;
|
reader.read_to_end(&mut ciphertext)?;
|
||||||
let decrypted = cipher.decrypt(&mut ciphertext)?;
|
ciphertext = base64::decode(ciphertext)?;
|
||||||
|
let size: usize = ciphertext.len() / 16 + 1;
|
||||||
|
let mut buffer = vec![0xffu8; 16 * size];
|
||||||
|
buffer[..ciphertext.len()].copy_from_slice(&ciphertext);
|
||||||
|
let decrypted = cipher.clone().decrypt(&mut buffer[..ciphertext.len()])?;
|
||||||
|
|
||||||
account = serde_json::from_slice(decrypted)?;
|
account = serde_json::from_slice(decrypted)?;
|
||||||
}
|
}
|
||||||
(None, Some(_)) => {
|
(None, Some(_)) => {
|
||||||
|
|
Loading…
Reference in a new issue