# $Id$ import glob, rpki.up_down, rpki.left_right, rpki.relaxng, xml.sax, lxml.etree, lxml.sax, POW, POW.pkix verbose = False def test(fileglob, rng, sax_handler, encoding, tester=None): files = glob.glob(fileglob) files.sort() for f in files: print "\n" handler = sax_handler() elt_in = lxml.etree.parse(f).getroot() rng.assertValid(elt_in) lxml.sax.saxify(elt_in, handler) elt_out = handler.result.toXML() rng.assertValid(elt_out) if (tester): tester(elt_in, elt_out, handler.result) print lxml.etree.tostring(elt_out, pretty_print=True, encoding=encoding, xml_declaration=True) def pprint_cert(cert): print POW.derRead(POW.X509_CERTIFICATE, cert.toString()).pprint() def ud_tester(elt_in, elt_out, msg): assert isinstance(msg, rpki.up_down.message_pdu) if verbose: if isinstance(msg.payload, rpki.up_down.list_response_pdu): for c in msg.payload.classes: for i in range(len(c.certs)): print "[Certificate #%d]" % i pprint_cert(c.certs[i].cert) print "[Issuer]" pprint_cert(c.issuer) def lr_tester(elt_in, elt_out, msg): assert isinstance(msg, rpki.left_right.msg) if verbose: for bsc in [x for x in msg if isinstance(x, rpki.left_right.bsc_elt)]: for cert in bsc.signing_cert: pprint_cert(cert) test(fileglob="up-down-protocol-samples/*.xml", rng=rpki.relaxng.up_down, sax_handler=rpki.up_down.sax_handler, encoding="utf-8", tester=ud_tester) test(fileglob="left-right-protocol-samples/*.xml", rng=rpki.relaxng.left_right, sax_handler=rpki.left_right.sax_handler, encoding="us-ascii", tester=lr_tester) class='right' method='get' action='/sra/rpki.net/log/openssl/trunk/ssl/t1_lib.c'>
path: root/openssl/trunk/ssl/t1_lib.c
blob: d4516eba71e077e0ffa09fa3ba53b5170ef93fd8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119