Class SigningBlockUtils
- java.lang.Object
-
- com.android.tools.build.apkzlib.utils.SigningBlockUtils
-
public final class SigningBlockUtils extends java.lang.ObjectGenerates and appends a new block to APK v2 Signature block.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]addToSigningBlock(byte[] signingBlock, byte[] blockValue, int blockId)Generates a new block with the given block value and block id, and appends it to the signing block.static java.nio.ByteBufferextractBlock(java.io.File apk, int blockId)Extract a block with the given id from the APK.
-
-
-
Method Detail
-
addToSigningBlock
public static byte[] addToSigningBlock(byte[] signingBlock, byte[] blockValue, int blockId) throws java.io.IOExceptionGenerates a new block with the given block value and block id, and appends it to the signing block.- Parameters:
signingBlock- Block containing v2 signature and (optionally) padding block or null.blockValue- byte array containing block value of the new block or null.blockId- block id of the new block.- Returns:
- APK v2 block with signatures and the new block. If
blockValueis null thesigningBlockis returned without any modification. IfsigningBlockis null, a new signature block is created containing the new block and, optionally, padding block. - Throws:
java.io.IOException
-
extractBlock
@Nullable public static java.nio.ByteBuffer extractBlock(java.io.File apk, int blockId) throws java.io.IOException, com.android.apksig.zip.ZipFormatException, com.android.apksig.apk.ApkSigningBlockNotFoundExceptionExtract a block with the given id from the APK. If there is more than one block with the same ID, the first block will be returned. If there are no block with the give id,nullwill be returned.- Parameters:
apk- APK fileblockId- id of the block to be extracted.- Throws:
java.io.IOExceptioncom.android.apksig.zip.ZipFormatExceptioncom.android.apksig.apk.ApkSigningBlockNotFoundException
-
-