add option to pass key pwd from arg
This commit is contained in:
parent
c0152e7608
commit
acd5c8445e
2 changed files with 14 additions and 7 deletions
|
|
@ -143,7 +143,7 @@ impl StringDataItem {
|
|||
let two = self.data[i] as u32;
|
||||
i += 1;
|
||||
if one & 0x20 == 0 {
|
||||
utf16_string.push((one & 0x1f) << 6 | (two & 0x3f));
|
||||
utf16_string.push(((one & 0x1f) << 6) | (two & 0x3f));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ impl StringDataItem {
|
|||
let three = self.data[i] as u32;
|
||||
i += 1;
|
||||
if one & 0x10 == 0 {
|
||||
utf16_string.push((one & 0x0f) << 12 | (two & 0x3f) << 6 | (three & 0x3f));
|
||||
utf16_string.push(((one & 0x0f) << 12) | ((two & 0x3f) << 6) | (three & 0x3f));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -167,7 +167,7 @@ impl StringDataItem {
|
|||
let four = self.data[i] as u32;
|
||||
i += 1;
|
||||
let code_point =
|
||||
(one & 0x0f) << 18 | (two & 0x3f) << 12 | (three & 0x3f) << 6 | (four & 0x3f);
|
||||
((one & 0x0f) << 18) | ((two & 0x3f) << 12) | ((three & 0x3f) << 6) | (four & 0x3f);
|
||||
let mut pair = ((code_point >> 10) + 0xd7c0) & 0xffff;
|
||||
pair |= ((code_point & 0x03ff) + 0xdc00) << 16;
|
||||
utf16_string.push(pair);
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ impl FileInfo {
|
|||
///
|
||||
/// The `zipalign` and `apksigner` args allow to use a specific version of the
|
||||
/// tools instead of the one in the PATH (if it even exist)
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn replace_dex(
|
||||
apk: impl AsRef<Path>,
|
||||
dst: impl AsRef<Path>,
|
||||
|
|
@ -159,6 +160,7 @@ pub fn replace_dex(
|
|||
// 2048 -validity 10000 -alias ALIAS`
|
||||
zipalign: Option<impl AsRef<Path>>,
|
||||
apksigner: Option<impl AsRef<Path>>,
|
||||
keypassword: Option<&str>,
|
||||
additionnal_files: Option<HashMap<String, Option<impl Read + Seek>>>,
|
||||
) {
|
||||
let zipalign = if let Some(path) = &zipalign {
|
||||
|
|
@ -233,14 +235,19 @@ pub fn replace_dex(
|
|||
.status()
|
||||
.unwrap();
|
||||
|
||||
Command::new(apksigner)
|
||||
let mut cmd = Command::new(apksigner);
|
||||
let cmd = cmd
|
||||
.arg("sign")
|
||||
.arg("--ks")
|
||||
.arg(keystore.as_ref().as_os_str())
|
||||
.arg("--out")
|
||||
.arg(dst.as_ref().as_os_str())
|
||||
.arg(aligned_path.as_os_str())
|
||||
.status()
|
||||
.unwrap();
|
||||
.arg(aligned_path.as_os_str());
|
||||
let cmd = if let Some(pwd) = keypassword {
|
||||
cmd.arg("--ks-pass").arg(format!("pass:${pwd}"))
|
||||
} else {
|
||||
cmd
|
||||
};
|
||||
cmd.status().unwrap();
|
||||
fs::remove_dir_all(tmp_dir).expect("Failled to remove tmp dir");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue