Hi,
The error messages don't necessarily give enough information to debug these things. in addition to what Joseph suggested verify that your encryptedtext - variable really contains only the encrypted text part, for example adding the text node match to your xpath:
<xsl:variable name="encryptedtext" select="//*[local-name()='companyType']/text()"/>
------------------------------
Hermanni Pernaa
------------------------------
Original Message:
Sent: Fri April 14, 2023 11:19 AM
From: Jack sully
Subject: Decrypt the encrypted response from Java
Thanks for sharing this valuable information.
1. Java service encrypting the data and returning secretKey in the response
2. Provided the private key file to decrypt the data
3. In Data Power configured the below code.
<xsl:variable name="RSAAlg" select="'http://www.w3.org/2001/04/xmlenc#rsa-1_5'"/>
<xsl:variable name="privateKey" select="'name:crypto-key-pass'"/>
<xsl:variable name="secretKeyEncrypted" select="//*[local-name()='secretKey']"/>
<xsl:variable name="secretKeyDecrypted">
<xsl:value-of select="dp:decrypt-key($secretKeyEncrypted,$privateKey,$RSAAlg)"/>
</xsl:variable>
<xsl:variable name="encryptedtext" select="//*[local-name()='companyType']"/>
<xsl:variable name="vDecrypt">
<xsl:value-of select="dp:decrypt-data($vAlgorithm,$secretKeyDecrypted,$encryptedtext)"/>
</xsl:variable>
Code is failed with java development services below error.
*RSA decryption failed*
Ephemeral key decryption failed: *RSA decryption failed*
Could you please help on the below issue
------------------------------
Jack sully
Original Message:
Sent: Fri October 28, 2022 02:35 PM
From: vijendhar soma
Subject: Decrypt the encrypted response from Java
Hi,
1. Java service encrypting the data and returning secretKey in the response
2. Provided the private key file to decrypt the data
3. In Data Power configured the below code.
<xsl:variable name="RSAAlg" select="'http://www.w3.org/2001/04/xmlenc#rsa-1_5'"/>
<xsl:variable name="privateKey" select="'name:crypto-key-pass'"/>
<xsl:variable name="secretKeyEncrypted" select="//*[local-name()='secretKey']"/>
<xsl:variable name="secretKeyDecrypted">
<xsl:value-of select="dp:decrypt-key($secretKeyEncrypted,$privateKey,$RSAAlg)"/>
</xsl:variable>
<xsl:variable name="encryptedtext" select="//*[local-name()='companyType']"/>
<xsl:variable name="vDecrypt">
<xsl:value-of select="dp:decrypt-data($vAlgorithm,$secretKeyDecrypted,$encryptedtext)"/>
</xsl:variable>
Code is failed with below error.
*RSA decryption failed*
Ephemeral key decryption failed: *RSA decryption failed*
Could you please help on the below issue
------------------------------
vijendhar soma
------------------------------