parseapk/parse_apk.py
def parse_certificates(data, offset, length):
    '''parses a sequence of certificates (inside APK Signature Scheme v2 Block)
    '''
    i = 0
    nb = 1
    while i < length:
        certificate_length = struct.unpack("<L", data[offset+i: offset+i+4])[0]
        print "\t\t\tCertificate #%d length=%d" % (nb, certificate_length)
        certificate = data[offset+4+i:offset+4+i+certificate_length]
        print "\t\t\tASN.1 DER certificate: ", certificate.encode('hex')
        nb = nb + 1
        i = i + 4 + certificate_length
        
    if i != length:
        print "WARNING: parse_certificates() error: i=%d length=%d" % (i, length)
parses a sequence of certificates (inside APK Signature Scheme v2 Block)
    
parses a sequence of certificates (inside APK Signature Scheme v2 Block)
parses a sequence of certificates ( inside APK Signature Scheme v2 Block )
def parse_certificates(data, offset, length):
    i = 0
    nb = 1
    while i < length:
        certificate_length = struct.unpack("<L", data[offset+i: offset+i+4])[0]
        print "\t\t\tCertificate #%d length=%d" % (nb, certificate_length)
        certificate = data[offset+4+i:offset+4+i+certificate_length]
        print "\t\t\tASN.1 DER certificate: ", certificate.encode('hex')
        nb = nb + 1
        i = i + 4 + certificate_length
    if i != length:
        print "WARNING: parse_certificates() error: i=%d length=%d" % (i, length)
def parse_certificates ( data , offset , length ) : i = 0 nb = 1 while i < length : certificate_length = struct . unpack ( "<L" , data [ offset + i : offset + i + 4 ] ) [ 0 ] print "\t\t\tCertificate #%d length=%d" % ( nb , certificate_length ) certificate = data [ offset + 4 + i : offset + 4 + i + certificate_length ] print "\t\t\tASN.1 DER certificate: " , certificate . encode ( 'hex' ) nb = nb + 1 i = i + 4 + certificate_length if i != length : print "WARNING: parse_certificates() error: i=%d length=%d" % ( i , length )
parses a sequence of certificates (inside APK Signature Scheme v2 Block)
parses a sequence of certificates ( inside APK Signature Scheme v2 Block )
'''parses a sequence of certificates (inside APK Signature Scheme v2 Block)
    '''
data
offset
length