; ; Transfer vector for VAX shareable image ; .TITLE ENGINE .IDENT /ENGINE/ ; ; Define macro to assist in building transfer vector entries. Each entry ; should take no more than 8 bytes. ; .MACRO FTRANSFER_ENTRY routine .ALIGN QUAD .TRANSFER routine .MASK routine JMP routine+2 .ENDM FTRANSFER_ENTRY ; ; Place entries in own program section. ; .PSECT $$ENGINE,QUAD,PIC,USR,CON,REL,LCL,SHR,EXE,RD,NOWRT ENGINE_xfer: FTRANSFER_ENTRY bind_engine FTRANSFER_ENTRY v_check .BLKB 32768-<.-ENGINE_xfer> ; 64 pages total. .END >index : sra/rpki.net
Dragon Research Labs RPKI Toolkitgit user
aboutsummaryrefslogblamecommitdiff
path: root/rp/utils/scan_routercerts
blob: 74cd2b6900b33eddc8b89ef134362a9fb23d2d7e (plain) (tree)
1
2
3
4
5
6
7
8
9

                     
 
                                                 
 


                                                                          
 












                                                                             


             



                

                                                        
                 
                            
                                                                             
            
 
                                                       

                                                                   
                          
 
                                                                            
 

                                                                 
 
                                                                        
 


                                                
 
                                                                                           
#!/usr/bin/env python
# $Id$
#
# Copyright (C) 2014 Dragon Research Labs ("DRL")
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND DRL DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS.  IN NO EVENT SHALL DRL BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.

"""
Scan rcynic validated output looking for router certificates, print
out stuff that the rpki-rtr code cares about.
"""

import os
import sys
import base64
import argparse
import rpki.POW
import rpki.oids

from rpki.rcynicdb.iterator import authenticated_objects

def check_dir(s):
    if not os.path.isdir(s):
        raise argparse.ArgumentTypeError("{!r} is not a directory".format(s))
    return s

parser = argparse.ArgumentParser(description = __doc__)
parser.add_argument("rcynic_dir", nargs = "?", type = check_dir,
                    help = "rcynic authenticated output directory")
args = parser.parse_args()

for uri, cer in authenticated_objects(args.rcynic_dir, uri_suffix = ".cer"):

    if rpki.oids.id_kp_bgpsec_router not in (cer.getEKU() or ()):
        continue

    sys.stdout.write(base64.urlsafe_b64encode(cer.getSKI()).rstrip("="))

    for min_asn, max_asn in cer.getRFC3779()[0]:
        for asn in xrange(min_asn, max_asn + 1):
            sys.stdout.write(" {}".format(asn))

    sys.stdout.write(" {}\n".format(base64.b64encode(cer.getPublicKey().derWritePublic())))