make signer_fingerprint() accept DER encoded certs

androguard's v2 signature methods return DER-encoded certificates.  The DER-
encoded certificates are parsed from JAR Signature's raw "Signature Block
File".
This commit is contained in:
Hans-Christoph Steiner 2019-01-30 14:12:51 +01:00
parent 4d68163175
commit ea84014f9b
4 changed files with 24 additions and 21 deletions

View file

@ -751,7 +751,7 @@ def get_public_key_from_jar(jar):
:return: the public key from the jar and its fingerprint
"""
# extract certificate from jar
certs = [n for n in jar.namelist() if common.CERT_PATH_REGEX.match(n)]
certs = [n for n in jar.namelist() if common.SIGNATURE_BLOCK_FILE_REGEX.match(n)]
if len(certs) < 1:
raise VerificationException(_("Found no signing certificates for repository."))
if len(certs) > 1: