const ( // Type of this signer is "apk" Type = "apk" // ZIPMethodCompressAll represents the default option to // compress all files in repacked JARs ZIPMethodCompressAll = "all" // ZIPMethodCompressPassthrough represents the option to pass // through all files with their current compression in JARs ZIPMethodCompressPassthrough = "passthrough" )
An APKSigner is configured to issue PKCS7 detached signatures for Android application packages.
New initializes an apk signer using a configuration
Config returns the configuration of the current signer
GetDefaultOptions returns default options of the signer
SignData takes a JAR signature file and returns a pkcs7 signature
SignFile takes an unsigned, unaligned APK in base64 form, generates the JAR manifests and calls SignData to sign the signature file using the configured private key.
The PKCS7 detached signature and the manifests are then stored inside the ZIP file under META-INF, and the whole archived is aligned. The returned data is the signed aligned APK.
This implements apksigning v1, aka jarsigner. apksigning v2 is not supported.
Options is empty for this signer type
GetOptions takes a input interface and reflects it into a struct of options
PK7Digest validates and return an ASN OID for a PKCS7 digest algorithm or an error. If no specific digest is specific, SHA256 is used.
Signature is a PKCS7 detached signature
Unmarshal takes the base64 representation of a PKCS7 detached signature and the content of the signed data, and returns a PKCS7 struct
Marshal returns the base64 representation of a PKCS7 detached signature
String returns a PEM encoded PKCS7 block
Verify verifies an apk pkcs7 signature WARNING: this function does not verify the JAR manifests