blob: 9155657069675dda5bccc16d5dbc0e247e6dc6d0 [file] [log] [blame]
#!/usr/bin/env python
# Copyright (c) 2018, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
import os
import subprocess
import utils
def sign(unsigned_apk, signed_apk, keystore, quiet=False, logging=True):
utils.Print('Signing (ignore the warnings)', quiet=quiet)
cmd = ['zip', '-d', unsigned_apk, 'META-INF/*']
utils.RunCmd(cmd, quiet=quiet, logging=logging, fail=False)
cmd = [
'-sigalg', 'SHA1withRSA',
'-digestalg', 'SHA1',
'-keystore', keystore,
'-storepass', 'android',
'-signedjar', signed_apk,
utils.RunCmd(cmd, quiet=quiet)
def sign_with_apksigner(
unsigned_apk, signed_apk, keystore, password='android', quiet=False,
cmd = [
os.path.join(utils.getAndroidBuildTools(), 'apksigner'),
'--ks', keystore,
'--ks-pass', 'pass:' + password,
'--min-sdk-version', '19',
'--out', signed_apk,
utils.RunCmd(cmd, quiet=quiet, logging=logging)