Hello Everyone,
We are using aes256-cbc algorithm & It's a symmetric algorithm. We are able to encrypt message but when tried to decrypt message then we are getting below response. We are using xslt code which is configured on DataPower
<?xml version="1.0" encoding="UTF-8"?>
<DecryptedResponse>
<DecryptedText>*NULL decryption result*</DecryptedText>
</DecryptedResponse>
Please find below decryption code for the same
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dp="http://www.datapower.com/extensions"
xmlns:dpconfig="http://www.datapower.com/param/config"
xmlns:apim="http://www.ibm.com/apimanagement"
xmlns:webapi="http://www.ibm.com/apimanagement"
xmlns:func="http://exslt.org/functions"
xmlns:wxsl="http://www.w3.org/1999/XSL/TransformAlias"
xmlns:exsl="http://exslt.org/common"
extension-element-prefixes="dp dpconfig exsl apim"
exclude-result-prefixes="wxsl func dp">
<xsl:template match="/">
<xsl:variable name="alg" select="'http://www.w3.org/2001/04/xmlenc#aes256-cbc'"/>
<xsl:variable name="vKey" select="'name:secretkey'"/>
<xsl:variable name="iv" select="'2F52B7EB7C17996A'"/>
<xsl:variable name="vencryptedText" select="//*[local-name()='encryptedText']"/>
<xsl:variable name="cipher-with-iv" select="dp:concat-base64($iv, $vencryptedText)"/>
<xsl:variable name="vDecrypt">
<xsl:value-of select="dp:decrypt-data($alg, $vKey, $cipher-with-iv)"/>
</xsl:variable>
<DecryptedResponse>
<DecryptedText>
<xsl:value-of select="$vDecrypt"/>
</DecryptedText>
</DecryptedResponse>
</xsl:template>
</xsl:stylesheet>
------------------------------
Prashant Patel
------------------------------