public class SignedJarWriter extends JarWriter
JarWriter.MyMultiDigestOutputStreamcreator, currentManifestEntry, DEFAULT_DIGEST_ALGORITHM, digestAlgorithms, manifestEntryWriter, zipEntryWriter| Constructor and Description |
|---|
SignedJarWriter(java.security.KeyStore.PrivateKeyEntry privateKeyEntry,
DataEntryWriter zipEntryWriter)
Creates a new SignedJarWriter.
|
SignedJarWriter(java.security.KeyStore.PrivateKeyEntry privateKeyEntry,
java.lang.String[] digestAlgorithms,
java.lang.String creator,
DataEntryWriter zipEntryWriter)
Creates a new SignedJarWriter with the given settings.
|
SignedJarWriter(java.security.KeyStore.PrivateKeyEntry privateKeyEntry,
java.lang.String[] digestAlgorithms,
java.lang.String creator,
int[] apkSignatureSchemeIDs,
DataEntryWriter zipEntryWriter)
Creates a new SignedJarWriter with the given settings.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.io.OutputStream |
createManifestOutputStream(DataEntry manifestEntry)
Creates an output stream for the specified manifest file.
|
java.io.OutputStream |
createOutputStream(DataEntry dataEntry)
Creates a new output stream for writing data.
|
protected void |
finish()
Writes out the collected manifest file before closing the jar, if any.
|
static void |
main(java.lang.String[] args)
Provides a simple test for this class, creating a signed apk file (only v1) with the given name
and a few aligned/compressed/uncompressed zip entries.
|
protected void |
openManifestFiles()
Prepares streams and writers for capturing digests of a parent entry.
|
void |
println(java.io.PrintWriter pw,
java.lang.String prefix)
Prints out the structure of the data entry writer.
|
close, createDirectory, finishIfNecessary, printWriter, sameOutputStreampublic SignedJarWriter(java.security.KeyStore.PrivateKeyEntry privateKeyEntry,
DataEntryWriter zipEntryWriter)
privateKeyEntry - the private key to be used for signing the zip entries.zipEntryWriter - the data entry writer that can provide output streams for the jar
entries.public SignedJarWriter(java.security.KeyStore.PrivateKeyEntry privateKeyEntry,
java.lang.String[] digestAlgorithms,
java.lang.String creator,
DataEntryWriter zipEntryWriter)
privateKeyEntry - the private key to be used for signing the zip entries.digestAlgorithms - the manifest digest algorithms, e.g. "SHA-256".creator - the creator to mention in the manifest file.zipEntryWriter - the data entry writer that can provide output streams for the jar
entries.public SignedJarWriter(java.security.KeyStore.PrivateKeyEntry privateKeyEntry,
java.lang.String[] digestAlgorithms,
java.lang.String creator,
int[] apkSignatureSchemeIDs,
DataEntryWriter zipEntryWriter)
privateKeyEntry - the private key to be used for signing the zip entries.digestAlgorithms - the manifest digest algorithms, e.g. "SHA-256".creator - the creator to mention in the manifest file.apkSignatureSchemeIDs - an optional list of external APK signature scheme IDs to be
specified with the attribute "X-Android-APK-Signed" in *.SF files.zipEntryWriter - the data entry writer that can provide output streams for the jar
entries.public java.io.OutputStream createOutputStream(DataEntry dataEntry) throws java.io.IOException
DataEntryWritercreateOutputStream in interface DataEntryWritercreateOutputStream in class JarWriterdataEntry - the data entry for which the output stream is to be created.null to indicate that the data entry
should not be written.java.io.IOExceptionpublic void println(java.io.PrintWriter pw,
java.lang.String prefix)
DataEntryWriterprintln in interface DataEntryWriterprintln in class JarWriterpw - the print stream to which the structure should be printed.prefix - a prefix for every printed line.protected void openManifestFiles()
throws java.io.IOException
JarWriteropenManifestFiles in class JarWriterjava.io.IOExceptionprotected java.io.OutputStream createManifestOutputStream(DataEntry manifestEntry) throws java.io.IOException
JarWritercreateManifestOutputStream in class JarWriterjava.io.IOExceptionprotected void finish()
throws java.io.IOException
JarWriterpublic static void main(java.lang.String[] args)