Class APKSigSchemeV2Block
java.lang.Object
com.pnfsoftware.jeb.core.units.code.android.APKSigSchemeV2Block
- Direct Known Subclasses:
APKSigSchemeV3Block
This class represents an
APK Signature Scheme v2 Block.
Reference: https://source.android.com/docs/security/features/apksigning/v2
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAn additional attribute stored in signed data.static classA signer certificate record.static classA digest record stored in a signer block.static classA signer public key record.static classA signature record stored in a signer block.static classA signer entry of an APK Signature Scheme v2 block. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDSA with SHA2-256 digest.static final intECDSA with SHA2-256 digest.static final intECDSA with SHA2-512 digest.static final intRSASSA-PKCS1-v1_5 with SHA2-256 digest.static final intRSASSA-PKCS1-v1_5 with SHA2-512 digest.static final intRSASSA-PSS with SHA2-256 digest, SHA2-256 MGF1, 32 bytes of salt, trailer: 0xbc.static final intRSASSA-PSS with SHA2-512 digest, SHA2-512 MGF1, 64 bytes of salt, trailer: 0xbc. -
Constructor Summary
ConstructorsConstructorDescriptionCreate and parse a byte buffer containing the raw data of a signature scheme v2 block. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringalgoIdToString(int id) Convert a signature/digest algorithm id to a human-readable identifier string.Retrieve the list ofsignerblocks.protected voidparse(int available) Parse signer records from the current buffer.protected byte[]readBytes(int len) Read a sequence of bytes.protected intreadInt()Read a signed 32-bit integer.protected intreadSize()Read a length-prefixed record size.protected voidskipAndWarnIfNonZero(int len) Skip remaining bytes and log a trace message if the record is not exhausted.protected voidskipBytes(int len) Skip bytes from the current buffer position.toString()protected voidverifyZero(int len) Verify that no bytes remain in the current record.
-
Field Details
-
SigAlgoId_RSASSA_PSS_SHA2_256
public static final int SigAlgoId_RSASSA_PSS_SHA2_256RSASSA-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_512RSASSA-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_256RSASSA-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_512RSASSA-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_256ECDSA with SHA2-256 digest.- See Also:
-
SigAlgoId_ECDSA_SHA2_512
public static final int SigAlgoId_ECDSA_SHA2_512ECDSA with SHA2-512 digest.- See Also:
-
SigAlgoId_DSA_SHA2_256
public static final int SigAlgoId_DSA_SHA2_256DSA with SHA2-256 digest.- See Also:
-
-
Constructor Details
-
APKSigSchemeV2Block
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
Convert a signature/digest algorithm id to a human-readable identifier string.- Parameters:
id- one ofSigAlgoId_Xxx.- Returns:
- the algorithm name
-
getSigners
Retrieve the list ofsignerblocks.- Returns:
- the signer blocks
-
toString
-
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
-