예제 #1
0
파일: verify.py 프로젝트: migurski/GOSM
def main(gpg_command, gpg_key, way_ids):
    """
    """
    for way_id in way_ids:
        signature, tag_names = GOSM.way_signature(way_id, gpg_key)
        
        if signature:
            message = GOSM.encode_way(way_id, tag_names)
            verified = GOSM.verify_signature(gpg_command, message, signature)

            if verified:
                print >> sys.stderr, 'Signature OK on', way_id
            else:
                print >> sys.stderr, 'Signature FAIL on', way_id
        else:
            print >> sys.stderr, 'No signature on', way_id
    
    return 0
예제 #2
0
파일: sign.py 프로젝트: migurski/GOSM
def main(osm_user, osm_pass, gpg_command, gpg_key, way_ids, tag_names):
    """
    """
    out = csv.writer(sys.stdout, 'excel-tab')
    changeset = GOSM.open_changeset(osm_user, osm_pass)
    
    for way_id in way_ids:
        message = GOSM.encode_way(way_id, tag_names)
        signature = GOSM.sign_message(gpg_command, gpg_key, message)
        verified = GOSM.verify_signature(gpg_command, message, signature)

        if not verified:
            print >> sys.stderr, 'Signature FAIL'
    
        row = ['%sT%sZ' % (str(datetime.datetime.utcnow())[:10], str(datetime.datetime.utcnow())[11:19])]
        row += [gpg_key, 'way', way_id]
        row += [b64encode(signature), ' '.join(tag_names)]
        out.writerow(row)
    
        GOSM.sign_way(osm_user, osm_pass, changeset, gpg_key, way_id, tag_names, signature)

    GOSM.close_changeset(osm_user, osm_pass, changeset)
    
    return 0