RESOLVED!!!!
Script updated with below.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dp="http://www.datapower.com/extensions"
xmlns:func="http://exslt.org/functions"
xmlns:apim="http://www.ibm.com/apimanagement" extension-element-prefixes="dp func apim">
<xsl:import href="local:/isp/policy/apim.custom.xsl"/>
<xsl:template match="/">
<xsl:variable name="client-id" select="apim:getVariable('request.headers.cek')" />
<xsl:variable name="OAEPParameters" select="''" />
<xsl:variable name="algorithm" select="'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p'" />
<xsl:variable name="OAEPDigestAlgorithm" select="'http://www.w3.org/2001/04/xmlenc#sha512'" />
<xsl:variable name="sessionKey" select="$client-id"/>
<xsl:variable name="recipient" select="'name:bank'"/>
<xsl:variable name="encryptOut">
<xsl:value-of select="dp:encrypt-key($sessionKey, $recipient, $algorithm, $OAEPParameters, $OAEPDigestAlgorithm)"/>
</xsl:variable>
<EncryptedValue>
<xsl:copy-of select="$encryptOut"/>
</EncryptedValue>
</xsl:template>
</xsl:stylesheet>
------------------------------
Jayprakash Yadav
------------------------------
Original Message:
Sent: Mon May 09, 2022 01:02 AM
From: Jayprakash Yadav
Subject: RSA/ECB/OAEPWithSHA-512AndMGF1Padding Encryption using dp:encrypt-key()
Hi,
I have requirement for encryption of my AES key using RSA/ECB/OAEPWithSHA-512AndMGF1Padding, below is XSLT policy, resulting in *key encryption failed*.
Anyone could help me figure out, where I am doing wrong.
<xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dp="http://www.datapower.com/extensions"
xmlns:func="http://exslt.org/functions"
xmlns:apim="http://www.ibm.com/apimanagement" extension-element-prefixes="dp func apim">
<xsl:import href="local:/isp/policy/apim.custom.xsl"/>
<xsl:template match="/">
<xsl:variable name="client-id" select="apim:getVariable('request.headers.cek')" />
<xsl:variable name="OAEPParameters" select="'9lWu3Q=='" />
<xsl:variable name="algorithm" select="'http://www.w3.org/2009/xmlenc11#rsa-oaep'" />
<xsl:variable name="OAEPDigestAlgorithm" select="'http://www.w3.org/2001/04/xmlenc#sha512'" />
<xsl:variable name="MGFAlgorithm" select="'http://www.w3.org/2009/xmlenc11#mgf1sha512'" />
<xsl:variable name="sessionKey" select="$client-id"/>
<xsl:variable name="recipient" select="'name:bank'"/>
<xsl:variable name="encryptOut">
<xsl:value-of select="dp:encrypt-key($sessionKey,$recipient,$algorithm,$OAEPParameters,$OAEPDigestAlgorithm,$MGFAlgorithm)"/>
</xsl:variable>
<EncryptedValue>
<xsl:copy-of select="$encryptOut"/>
</EncryptedValue>
</xsl:template>
</xsl:stylesheet>
------------------------------
Jayprakash Yadav
------------------------------