mirror of
https://github.com/pumpbin/pumpbin
synced 2026-03-14 23:04:30 -07:00
fix: encrypt_type not set
This commit is contained in:
@@ -687,6 +687,7 @@ impl Application for Pumpbin {
|
|||||||
self.supported_platforms = platforms;
|
self.supported_platforms = platforms;
|
||||||
|
|
||||||
// random pass
|
// random pass
|
||||||
|
self.encrypt_type = plugin.encrypt_type().clone();
|
||||||
self.random_encrypt_pass();
|
self.random_encrypt_pass();
|
||||||
|
|
||||||
Task::none()
|
Task::none()
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use std::{collections::HashMap, fmt::Display, fs, ops::Not, path::Path};
|
use std::{collections::HashMap, fmt::Display, fs, ops::Not, path::Path};
|
||||||
|
|
||||||
use aes_gcm::{aead::Aead, Aes256Gcm, KeyInit, Nonce};
|
use aes_gcm::{aead::Aead, Aes256Gcm, Key, KeyInit, Nonce};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use bincode::{decode_from_slice, encode_to_vec, Decode, Encode};
|
use bincode::{decode_from_slice, encode_to_vec, Decode, Encode};
|
||||||
use dirs::data_dir;
|
use dirs::data_dir;
|
||||||
@@ -77,11 +77,10 @@ impl EncryptType {
|
|||||||
.map(|(i, byte)| byte ^ x[i % x.len()])
|
.map(|(i, byte)| byte ^ x[i % x.len()])
|
||||||
.collect()),
|
.collect()),
|
||||||
EncryptType::AesGcm(x) => {
|
EncryptType::AesGcm(x) => {
|
||||||
let key = aes_gcm::Key::<Aes256Gcm>::from_slice(x.key_holder());
|
let key = Key::<Aes256Gcm>::from_slice(x.key_holder());
|
||||||
let aes = Aes256Gcm::new(key);
|
let aes = Aes256Gcm::new(key);
|
||||||
let nonce = Nonce::from_slice(x.nonce_holder());
|
let nonce = Nonce::from_slice(x.nonce_holder());
|
||||||
aes.encrypt(nonce, data.as_slice())
|
aes.encrypt(nonce, data.as_slice()).map_err(|e| anyhow!(e))
|
||||||
.map_err(|e| anyhow!(e.to_string()))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user