android_vendor_mulchwebview/updater/certificates.py

12 lines
329 B
Python
Raw Normal View History

2023-03-08 14:38:17 -05:00
import subprocess
def get_apk_certificate(file: str):
output = subprocess.check_output(['keytool', '-printcert', '-rfc', '-jarfile', file], text=True)
lines = output.split("\n")
return '\n'.join(lines[
lines.index('-----BEGIN CERTIFICATE-----'):
(lines.index('-----END CERTIFICATE-----')+1)
])