public final class SigningBlockUtils
extends java.lang.Object
| Modifier and Type | Method and 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.ByteBuffer |
extractBlock(java.io.File apk,
int blockId)
Extract a block with the given id from the APK.
|
public static byte[] addToSigningBlock(byte[] signingBlock,
byte[] blockValue,
int blockId)
throws java.io.IOException
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.blockValue is null the
signingBlock is returned without any modification. If signingBlock is null,
a new signature block is created containing the new block and, optionally, padding block.java.io.IOException@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.ApkSigningBlockNotFoundException
null will
be returned.apk - APK fileblockId - id of the block to be extracted.java.io.IOExceptioncom.android.apksig.zip.ZipFormatExceptioncom.android.apksig.apk.ApkSigningBlockNotFoundException