程序包 proguard.io
类 SignedJarWriter
- java.lang.Object
-
- proguard.io.JarWriter
-
- proguard.io.SignedJarWriter
-
- 所有已实现的接口:
java.lang.AutoCloseable,DataEntryWriter
public class SignedJarWriter extends JarWriter
-
-
嵌套类概要
-
从类继承的嵌套类/接口 proguard.io.JarWriter
JarWriter.MyMultiDigestOutputStream
-
-
字段概要
-
从类继承的字段 proguard.io.JarWriter
creator, currentManifestEntry, DEFAULT_DIGEST_ALGORITHM, digestAlgorithms, manifestEntryWriter, zipEntryWriter
-
-
构造器概要
构造器 构造器 说明 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.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, DataEntryWriter zipEntryWriter)Creates a new SignedJarWriter.
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 protected java.io.OutputStreamcreateManifestOutputStream(DataEntry manifestEntry)Creates an output stream for the specified manifest file.java.io.OutputStreamcreateOutputStream(DataEntry dataEntry)Creates a new output stream for writing data.protected voidfinish()Writes out the collected manifest file before closing the jar, if any.static voidmain(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 voidopenManifestFiles()Prepares streams and writers for capturing digests of a parent entry.voidprintln(java.io.PrintWriter pw, java.lang.String prefix)Prints out the structure of the data entry writer.-
从类继承的方法 proguard.io.JarWriter
close, createDirectory, finishIfNecessary, printWriter, sameOutputStream
-
-
-
-
构造器详细资料
-
SignedJarWriter
public SignedJarWriter(java.security.KeyStore.PrivateKeyEntry privateKeyEntry, DataEntryWriter zipEntryWriter)Creates a new SignedJarWriter.- 参数:
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.
-
SignedJarWriter
public SignedJarWriter(java.security.KeyStore.PrivateKeyEntry privateKeyEntry, java.lang.String[] digestAlgorithms, java.lang.String creator, DataEntryWriter zipEntryWriter)Creates a new SignedJarWriter with the given settings.- 参数:
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.
-
SignedJarWriter
public 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.- 参数:
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.
-
-
方法详细资料
-
createOutputStream
public java.io.OutputStream createOutputStream(DataEntry dataEntry) throws java.io.IOException
从接口复制的说明:DataEntryWriterCreates a new output stream for writing data. The caller is responsible for closing the stream.- 指定者:
createOutputStream在接口中DataEntryWriter- 覆盖:
createOutputStream在类中JarWriter- 参数:
dataEntry- the data entry for which the output stream is to be created.- 返回:
- the output stream. The stream may be
nullto indicate that the data entry should not be written. - 抛出:
java.io.IOException
-
println
public void println(java.io.PrintWriter pw, java.lang.String prefix)从接口复制的说明:DataEntryWriterPrints out the structure of the data entry writer.- 指定者:
println在接口中DataEntryWriter- 覆盖:
println在类中JarWriter- 参数:
pw- the print stream to which the structure should be printed.prefix- a prefix for every printed line.
-
openManifestFiles
protected void openManifestFiles() throws java.io.IOException从类复制的说明:JarWriterPrepares streams and writers for capturing digests of a parent entry.- 覆盖:
openManifestFiles在类中JarWriter- 抛出:
java.io.IOException
-
createManifestOutputStream
protected java.io.OutputStream createManifestOutputStream(DataEntry manifestEntry) throws java.io.IOException
从类复制的说明:JarWriterCreates an output stream for the specified manifest file.- 覆盖:
createManifestOutputStream在类中JarWriter- 抛出:
java.io.IOException
-
finish
protected void finish() throws java.io.IOException从类复制的说明:JarWriterWrites out the collected manifest file before closing the jar, if any.
-
main
public 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. Arguments: keystore keystore_password alias password jar_filename Create a keystore with: keytool -genkey -dname 'CN=John Doe, OU=Development, O=Guardsquare, STREET=Tervuursevest, L=Leuven, ST=Brabant, C=Belgium' -keystore /tmp/test.keystore -storepass android -alias AndroidDebugKey -keypass android -keyalg RSA -keysize 512 List the contents of the keystore with keytool -v -list -keystore /tmp/test.keystore -alias androiddebugkey -storepass android Verify the signed jar with: jarsigner -verify -verbose /tmp/test.jar or with: android-sdk/build-tools/24.0.3/apksigner verify --min-sdk-version 19 -v /tmp/test.jar
-
-