dex++ 0.3.1
C++ and C API reference
Loading...
Searching...
No Matches
dex::apk Namespace Reference

APK-level entry point: package metadata that exists independently of the bytecode. More...

Classes

class  Apk
 A loaded Android package. More...
 
struct  Certificate
 A signing certificate (X.509, decoded just enough for triage). More...
 
struct  Component
 One of activity / service / receiver / provider. More...
 
struct  IntentFilter
 An <intent-filter> distilled to the parts that matter for triage. More...
 
class  Manifest
 Typed AndroidManifest.xml. More...
 
struct  ResourceName
 The fully-qualified name of a resource: package:type/entry. More...
 
class  ResourceTable
 
struct  SigningInfo
 Signing schemes present in an APK and the certificates they carry. More...
 

Functions

SigningInfo parse_signing_info (std::span< const uint8_t > apk_bytes)
 Extract signing information from a whole-APK (ZIP) image.
 

Detailed Description

APK-level entry point: package metadata that exists independently of the bytecode.

APK signature inspection: which signing schemes are present (v1 JAR signing, v2/v3 APK Signing Block) and the signing certificates.

Parser for resources.arsc, the compiled resource table inside an APK.

Typed view over a decoded AndroidManifest.xml.

Separate from AnalysisContext on purpose — an Apk is a package (archive + manifest + resources), an AnalysisContext is its code. Use Apk::analysis() to cross from one to the other.

This is the security-triage surface: package identity, SDK levels, permissions, and the four component kinds with their exported flags and intent filters.

A boolean or integer attribute can be written as a resource reference, such as android:exported="@bool/is_exported". When the manifest is built with the APK's resource table (as apk::Apk::manifest() does), such a value is resolved through it, using the default configuration. The reference id itself is kept next to the value (Component::exported_reference, Manifest::debuggable_reference(), ...). A reference that cannot be resolved — no resource table, an id the table does not have, a value of another type, or a theme attribute ("?attr/...") — leaves the value nullopt but keeps the reference id, so "not written" (both nullopt) and "written, value unknown" (value nullopt, reference set) stay apart. Text attributes (android:name, android:permission, android:versionName) are read as written; a reference there is not resolved.

Scope: forward resolution of a resource id (0xPPTTEEEE) to its name and, for string, boolean and integer resources, its value — enough to resolve manifest references like android:label="@string/app_name" or android:exported="@bool/is_exported". Configuration variants (locale, density, API level) are collapsed to a single value, preferring the default (config-less) entry.

Scope is identification, not verification — the parser extracts the certificates and reports the schemes, it does NOT validate digests or signatures. Use apksigner for verification.

Function Documentation

◆ parse_signing_info()

SigningInfo dex::apk::parse_signing_info ( std::span< const uint8_t >  apk_bytes)

Extract signing information from a whole-APK (ZIP) image.

Never fails: an unsigned or unparseable input yields a default SigningInfo.