Skip to content

Commit

Permalink
Extract every embedded certificate, not just the first one in each Ke…
Browse files Browse the repository at this point in the history
…yDescriptor.
  • Loading branch information
iay committed Mar 31, 2009
1 parent 336e936 commit f8fc113
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions build/extract_embedded.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,30 @@
<xsl:output method="text"/>

<xsl:template match="//md:EntityDescriptor//md:KeyDescriptor[.//ds:X509Certificate]">
<xsl:text>Entity: </xsl:text>
<xsl:if test="ancestor::md:EntityDescriptor/@ID">
<xsl:text>[</xsl:text>
<xsl:value-of select='ancestor::md:EntityDescriptor/@ID'/>
<xsl:text>]</xsl:text>
</xsl:if>
<xsl:value-of select="ancestor::md:EntityDescriptor/@entityID"/>
<xsl:text> KeyName: </xsl:text>
<xsl:choose>
<xsl:when test=".//ds:KeyName">
<xsl:value-of select=".//ds:KeyName"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>(none)</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#x0a;</xsl:text>
<xsl:text>-----BEGIN CERTIFICATE-----&#x0a;</xsl:text>
<xsl:apply-templates select="str:tokenize(.//ds:X509Certificate)"/>
<xsl:text>-----END CERTIFICATE-----&#x0a;</xsl:text>
<xsl:variable name="keydesc" select="."/>
<xsl:variable name="entity" select="ancestor::md:EntityDescriptor"/>
<xsl:for-each select="$keydesc//ds:X509Certificate">
<xsl:text>Entity: </xsl:text>
<xsl:if test="$entity/@ID">
<xsl:text>[</xsl:text>
<xsl:value-of select='$entity/@ID'/>
<xsl:text>]</xsl:text>
</xsl:if>
<xsl:value-of select="$entity/@entityID"/>
<xsl:text> KeyName: </xsl:text>
<xsl:choose>
<xsl:when test="$keydesc//ds:KeyName">
<xsl:value-of select="$keydesc//ds:KeyName"/>
</xsl:when>
<xsl:otherwise>
<xsl:text>(none)</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:text>&#x0a;</xsl:text>
<xsl:text>-----BEGIN CERTIFICATE-----&#x0a;</xsl:text>
<xsl:apply-templates select="str:tokenize(.)"/>
<xsl:text>-----END CERTIFICATE-----&#x0a;</xsl:text>
</xsl:for-each>
</xsl:template>

<xsl:template match="token">
Expand Down

0 comments on commit f8fc113

Please sign in to comment.