Topic
  • 4 replies
  • Latest Post - ‏2013-07-23T19:22:09Z by JTQK_Sunny_Goel
RubenRandall
RubenRandall
89 Posts

Pinned topic base 64 decode failed

‏2013-07-14T08:51:02Z |

Hi ,

 

I am trying to get cert details using this stylesheet but, this is failing saying '*base64 decode of certificate failed*'

Could you please look at the stylesheet and let me know where I am going wrong..

 

<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.datapower.com/extensions"
    xmlns:date="http://exslt.org/dates-and-times"
    extension-element-prefixes="dp date" exclude-result-prefixes="dp date">
     <!-- This stylesheet reports on all cert objects in the domain -->
    <xsl:template match="/">
    
    <SOAP-ENV:Envelope
   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
   SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <SOAP-ENV:Header/>
   <SOAP-ENV:Body>
   <xsl:variable name="name" select="'cert:///DataPower-sscert.pem'"></xsl:variable>
   <xsl:variable name="certDetails"
                        select="dp:get-cert-details(concat('cert:',$name))" />
    <xsl:copy-of select="$certDetails"></xsl:copy-of>                    
       </SOAP-ENV:Body>
       </SOAP-ENV:Envelope>
    </xsl:template>
</xsl:stylesheet>

  • HermannSW
    HermannSW
    4733 Posts

    Re: base 64 decode failed

    ‏2013-07-14T10:54:10Z  

    Your concat will result in "cert:cert:///DataPower-sscert.pem", right?

    Please try  <xsl:variable name="name" select="'DataPower'"></xsl:variable> 

    The cert name is "DataPower", what you have in $name is the filename.

    <ADD>you can best identify the Crypto Certificate names via "Objects->Crypto Configuration->Crypto Certificate" in WebGUI</ADD>


    Hermann<myXsltBlog/> <myXsltTweets/> <myCE/>

     

    Updated on 2013-07-14T11:49:46Z at 2013-07-14T11:49:46Z by HermannSW
  • David07
    David07
    73 Posts

    Re: base 64 decode failed

    ‏2013-07-15T05:30:03Z  

    Hi Ruben,

    To map the datapower certificate  we can use either  name:certificatename or cert:certificatename parameters,

    for ex,

    <xsl:variable name="name" select="'cert:certificatename'"></xsl:variable>
    <xsl:variable name="certDetails"
    select="dp:get-cert-details($name)" />
    <xsl:copy-of select="$certDetails"></xsl:copy-of>

    Note:

    Certificate name you are providing should be the name of key object.

    Dont provide certificate name like this "DataPower-sscert.pem".

     

    David


     

  • RubenRandall
    RubenRandall
    89 Posts

    Re: base 64 decode failed

    ‏2013-07-15T23:03:29Z  
    • David07
    • ‏2013-07-15T05:30:03Z

    Hi Ruben,

    To map the datapower certificate  we can use either  name:certificatename or cert:certificatename parameters,

    for ex,

    <xsl:variable name="name" select="'cert:certificatename'"></xsl:variable>
    <xsl:variable name="certDetails"
    select="dp:get-cert-details($name)" />
    <xsl:copy-of select="$certDetails"></xsl:copy-of>

    Note:

    Certificate name you are providing should be the name of key object.

    Dont provide certificate name like this "DataPower-sscert.pem".

     

    David


     

    Thanks Hermann & David, now  I understood the concept - only certificate objects but not file name

    Thanks,

    Ruben

  • JTQK_Sunny_Goel
    JTQK_Sunny_Goel
    10 Posts

    Re: base 64 decode failed

    ‏2013-07-23T19:22:09Z  

    Hi Ruben,

    If you are trying to decode base 64 encoded cert present in "wsse:BinarySecurityToken" tag of soap message then you can use following piece of code in your stylesheet.

    <xsl:variable name="cert" select="concat('cert:',//*[name()='wsse:BinarySecurityToken'])"/>
    <xsl:variable name="cert-details" select="dp:get-cert-details($cert)"/>

    Please let me know in case of any concerns.

    Thanks