pub struct Signer { /* private fields */ }Expand description
Signs APKs with one or more identities.
Like apksigner, the schemes default to Schemes::for_min_sdk, and
the minimum and target API levels are read from the APK’s manifest unless
the minimum is set explicitly.
Implementations§
Source§impl Signer
impl Signer
pub fn new(identity: SigningIdentity) -> Self
Sourcepub fn with_signer(self, identity: SigningIdentity) -> Self
pub fn with_signer(self, identity: SigningIdentity) -> Self
Adds another signer (v1 and v2 only).
Sourcepub fn min_sdk(self, min_sdk: ApiLevel) -> Self
pub fn min_sdk(self, min_sdk: ApiLevel) -> Self
The oldest Android release the APK must install on, overriding the
manifest’s minSdkVersion. This selects the default schemes and the
JAR digest.
Sourcepub fn native_library_page_size(self, page_size: PageSize) -> Self
pub fn native_library_page_size(self, page_size: PageSize) -> Self
The page size stored native libraries are aligned to when re-signing an existing APK (default 16 KiB).
pub fn identities(&self) -> &[SigningIdentity]
Sourcepub fn sign_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
pub fn sign_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
Signs the APK at path in place. The file is replaced atomically, and
left untouched if signing fails.
Sourcepub fn sign(
&self,
input: impl AsRef<Path>,
output: impl AsRef<Path>,
) -> Result<(), Error>
pub fn sign( &self, input: impl AsRef<Path>, output: impl AsRef<Path>, ) -> Result<(), Error>
Signs input into output (which may be the same path). Existing
signatures are replaced, stored entries are realigned (native
libraries to pages, everything else to 4 bytes), and compressed data
is copied without recompressing it.