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
|
<!-- -*- SGML -*-
- $Id$
-
- Copyright (C) 2008 American Registry for Internet Numbers ("ARIN")
-
- Permission to use, copy, modify, and 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 ARIN DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL ARIN 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.
-->
<!--
- Decoder ring for testpoke.py XML output. Use this to get a
- (somewhat) human-readable listing and to put OpenSSL-style
- delimiters onto the certificates so that "openssl x509" can read
- the result. With a tad more work, we could select just one out of
- the set of multiple certificates, or output YAML. For the moment,
- I'll settle for being readable by human beings and OpenSSL.
-->
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:rpkiud="http://www.apnic.net/specs/rescerts/up-down/">
<xsl:output method="text"/>
<xsl:param name="show-issuer" select="0"/>
<xsl:template match="/rpkiud:message[@type = 'list_response']">
<xsl:value-of select="concat('[Message]', ' ',
'Version: ', @version, ' ',
'Sender: ', @sender, ' ',
'Recipient: ', @recipient, ' ')"/>
<xsl:apply-templates select="rpkiud:class"/>
</xsl:template>
<xsl:template match="rpkiud:class">
<xsl:value-of select="concat(' ',
'[Class]', ' ',
'Name: ', @class_name, ' ',
'Issuer URL: ', @cert_url, ' ',
'ASNs: ', @resource_set_as, ' ',
'IPv4: ', @resource_set_ipv4, ' ',
'IPv6: ', @resource_set_ipv6, ' ',
'NotAfter: ', @resource_set_notafter, ' ',
'SIA head: ', @suggested_sia_head, ' ')"/>
<xsl:if test="$show-issuer">
<xsl:apply-templates select="rpkiud:issuer"/>
</xsl:if>
<xsl:apply-templates select="rpkiud:certificate"/>
</xsl:template>
<xsl:template match="rpkiud:certificate">
<xsl:value-of select="concat(' ',
'[Certificate]', ' ',
'Subject URL: ', @cert_url, ' ',
'Req ASNs: ', @resource_set_as, ' ',
'Req IPv4: ', @resource_set_ipv4, ' ',
'Req IPv6: ', @resource_set_ipv6, ' ')"/>
<xsl:call-template name="show-pem"/>
</xsl:template>
<xsl:template match="rpkiud:issuer" name="show-pem">
<xsl:text> </xsl:text>
<xsl:text>-----BEGIN CERTIFICATE-----</xsl:text>
<xsl:text> </xsl:text>
<xsl:value-of select="text()"/>
<xsl:text>-----END CERTIFICATE-----</xsl:text>
<xsl:text> </xsl:text>
</xsl:template>
</xsl:transform>
|