Class APKSigSchemeV2Block

java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.APKSigSchemeV2Block
Direct Known Subclasses:
APKSigSchemeV3Block

@Ser public class APKSigSchemeV2Block extends Object
This class represents an APK Signature Scheme v2 Block.

Reference: https://source.android.com/docs/security/features/apksigning/v2

  • Field Details

    • SigAlgoId_RSASSA_PSS_SHA2_256

      public static final int SigAlgoId_RSASSA_PSS_SHA2_256
      RSASSA-PSS with SHA2-256 digest, SHA2-256 MGF1, 32 bytes of salt, trailer: 0xbc.
      See Also:
    • SigAlgoId_RSASSA_PSS_SHA2_512

      public static final int SigAlgoId_RSASSA_PSS_SHA2_512
      RSASSA-PSS with SHA2-512 digest, SHA2-512 MGF1, 64 bytes of salt, trailer: 0xbc.
      See Also:
    • SigAlgoId_RSASSA_PKCS1_v1_5_SHA2_256

      public static final int SigAlgoId_RSASSA_PKCS1_v1_5_SHA2_256
      RSASSA-PKCS1-v1_5 with SHA2-256 digest. This is for build systems which require deterministic signatures.
      See Also:
    • SigAlgoId_RSASSA_PKCS1_v1_5_SHA2_512

      public static final int SigAlgoId_RSASSA_PKCS1_v1_5_SHA2_512
      RSASSA-PKCS1-v1_5 with SHA2-512 digest. This is for build systems which require deterministic signatures.
      See Also:
    • SigAlgoId_ECDSA_SHA2_256

      public static final int SigAlgoId_ECDSA_SHA2_256
      ECDSA with SHA2-256 digest.
      See Also:
    • SigAlgoId_ECDSA_SHA2_512

      public static final int SigAlgoId_ECDSA_SHA2_512
      ECDSA with SHA2-512 digest.
      See Also:
    • SigAlgoId_DSA_SHA2_256

      public static final int SigAlgoId_DSA_SHA2_256
      DSA with SHA2-256 digest.
      See Also:
  • Constructor Details

    • APKSigSchemeV2Block

      public APKSigSchemeV2Block(ByteBuffer b)
      Create and parse a byte buffer containing the raw data of a signature scheme v2 block.
      Parameters:
      b - the raw v2 signature block data
  • Method Details

    • algoIdToString

      public static String algoIdToString(int id)
      Convert a signature/digest algorithm id to a human-readable identifier string.
      Parameters:
      id - one of SigAlgoId_Xxx.
      Returns:
      the algorithm name
    • getSigners

      public List<APKSigSchemeV2Block.Signer> getSigners()
      Retrieve the list of signer blocks.
      Returns:
      the signer blocks
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • parse

      protected void parse(int available)
      Parse signer records from the current buffer.
      Parameters:
      available - number of bytes available in the block
    • readSize

      protected int readSize()
      Read a length-prefixed record size.
      Returns:
      the record size in bytes
    • readInt

      protected int readInt()
      Read a signed 32-bit integer.
      Returns:
      the integer value
    • readBytes

      protected byte[] readBytes(int len)
      Read a sequence of bytes.
      Parameters:
      len - number of bytes to read
      Returns:
      the bytes read from the buffer
    • skipBytes

      protected void skipBytes(int len)
      Skip bytes from the current buffer position.
      Parameters:
      len - number of bytes to skip
    • verifyZero

      protected void verifyZero(int len)
      Verify that no bytes remain in the current record.
      Parameters:
      len - remaining byte count
    • skipAndWarnIfNonZero

      protected void skipAndWarnIfNonZero(int len)
      Skip remaining bytes and log a trace message if the record is not exhausted.
      Parameters:
      len - remaining byte count