public class DefaultApkSignerEngine extends Object implements ApkSignerEngine
ApkSignerEngine.
Use DefaultApkSignerEngine.SignerConfig.Builder to obtain instances of this engine.
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultApkSignerEngine.Builder
Builder of
DefaultApkSignerEngine instances. |
static class |
DefaultApkSignerEngine.SignerConfig
Configuration of a signer.
|
ApkSignerEngine.InputJarEntryInstructions, ApkSignerEngine.InspectJarEntryRequest, ApkSignerEngine.OutputApkSigningBlockRequest, ApkSignerEngine.OutputJarSignatureRequest| Modifier and Type | Method and Description |
|---|---|
void |
close()
Indicates to this engine that it will no longer be used.
|
void |
inputApkSigningBlock(DataSource apkSigningBlock)
Indicates to this engine that the input APK contains the provided APK Signing Block.
|
ApkSignerEngine.InputJarEntryInstructions |
inputJarEntry(String entryName)
Indicates to this engine that the specified JAR entry was encountered in the input APK.
|
ApkSignerEngine.InputJarEntryInstructions.OutputPolicy |
inputJarEntryRemoved(String entryName)
Indicates to this engine that the specified JAR entry was removed from the input.
|
void |
outputDone()
Indicates to this engine that the signed APK was output.
|
ApkSignerEngine.OutputJarSignatureRequest |
outputJarEntries()
Indicates to this engine that all JAR entries have been output.
|
ApkSignerEngine.InspectJarEntryRequest |
outputJarEntry(String entryName)
Indicates to this engine that the specified JAR entry was output.
|
void |
outputJarEntryRemoved(String entryName)
Indicates to this engine that the specified JAR entry was removed from the output.
|
ApkSignerEngine.OutputApkSigningBlockRequest |
outputZipSections(DataSource zipEntries,
DataSource zipCentralDirectory,
DataSource zipEocd)
Indicates to this engine that the ZIP sections comprising the output APK have been output.
|
public void inputApkSigningBlock(DataSource apkSigningBlock)
ApkSignerEngineinputApkSigningBlock in interface ApkSignerEngineapkSigningBlock - APK signing block of the input APK. The provided data source is
guaranteed to not be used by the engine after this method terminates.public ApkSignerEngine.InputJarEntryInstructions inputJarEntry(String entryName)
ApkSignerEngineWhen an input entry is updated/changed, it's OK to not invoke
ApkSignerEngine.inputJarEntryRemoved(String) before invoking this method.
inputJarEntry in interface ApkSignerEnginepublic ApkSignerEngine.InspectJarEntryRequest outputJarEntry(String entryName)
ApkSignerEngineIt is unnecessary to invoke this method for entries added to output by this engine (e.g.,
requested by ApkSignerEngine.outputJarEntries()) provided the entries were output with exactly the
data requested by the engine.
When an already output entry is updated/changed, it's OK to not invoke
ApkSignerEngine.outputJarEntryRemoved(String) before invoking this method.
outputJarEntry in interface ApkSignerEnginenull if the engine does not need to inspect
the entry. The request must be fulfilled before ApkSignerEngine.outputJarEntries() is
invoked.public ApkSignerEngine.InputJarEntryInstructions.OutputPolicy inputJarEntryRemoved(String entryName)
ApkSignerEngineApkSignerEngine.inputJarEntry(String) hasn't been invoked.inputJarEntryRemoved in interface ApkSignerEnginepublic void outputJarEntryRemoved(String entryName)
ApkSignerEngineApkSignerEngine.outputJarEntry(String) hasn't been invoked.outputJarEntryRemoved in interface ApkSignerEnginepublic ApkSignerEngine.OutputJarSignatureRequest outputJarEntries() throws ApkFormatException, InvalidKeyException, SignatureException, NoSuchAlgorithmException
ApkSignerEngineoutputJarEntries in interface ApkSignerEnginenull if there is no need to add
a JAR signature. The request will contain additional JAR entries to be output. The
request must be fulfilled before
ApkSignerEngine.outputZipSections(DataSource, DataSource, DataSource) is invoked.ApkFormatException - if the APK is malformed in a way which is preventing this engine
from producing a valid signature. For example, if the engine uses the provided
META-INF/MANIFEST.MF as a template and the file is malformed.InvalidKeyException - if a signature could not be generated because a signing key is
not suitable for generating the signatureSignatureException - if an error occurred while generating a signatureNoSuchAlgorithmException - if a signature could not be generated because a required
cryptographic algorithm implementation is missingpublic ApkSignerEngine.OutputApkSigningBlockRequest outputZipSections(DataSource zipEntries, DataSource zipCentralDirectory, DataSource zipEocd) throws IOException, InvalidKeyException, SignatureException, NoSuchAlgorithmException
ApkSignerEngineThe provided data sources are guaranteed to not be used by the engine after this method terminates.
outputZipSections in interface ApkSignerEnginezipEntries - the section of ZIP archive containing Local File Header records and data of
the ZIP entries. In a well-formed archive, this section starts at the start of the
archive and extends all the way to the ZIP Central Directory.zipCentralDirectory - ZIP Central Directory sectionzipEocd - ZIP End of Central Directory (EoCD) recordnull if the output must
not contain an APK Signing Block. The request must be fulfilled before
ApkSignerEngine.outputDone() is invoked.IOException - if an I/O error occurs while reading the provided ZIP sectionsInvalidKeyException - if a signature could not be generated because a signing key is
not suitable for generating the signatureSignatureException - if an error occurred while generating a signatureNoSuchAlgorithmException - if a signature could not be generated because a required
cryptographic algorithm implementation is missingpublic void outputDone()
ApkSignerEngineThis does not change the output APK. The method helps the client confirm that the current output is signed.
outputDone in interface ApkSignerEnginepublic void close()
ApkSignerEngineThis does not change the output APK. For example, if the output APK is not yet fully signed, it will remain so after this method terminates.
close in interface ApkSignerEngineclose in interface Closeableclose in interface AutoCloseableCopyright © 2016. All rights reserved.