DataPower

 View Only
  • 1.  Decrypt the encrypted data in Datapower.

    Posted Mon October 31, 2022 11:19 AM
    Hi,

    Data is encrypted in Java Application.
    To decrypt the data using the below code in Datapower.

    1. Provided the private key to decrypt the data
    2. Receiving the secretKey in the encrypted response
    3. Below is the XSLT code to decrypt the data.



    <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="vAlgorithm" select="'http://www.w3.org/2001/04/xmlenc#aes128-cbc'"/>
    <xsl:variable name="encryptedtext" select="//*[local-name()='companyType']"/>

    <xsl:variable name="vDecrypt">
    <xsl:value-of select="dp:decrypt-data($vAlgorithm,$secretKeyDecrypted,$encryptedtext)"/>
    </xsl:variable>
    <decryptedResponse>

    Getting the below error while executing the xslt code.

    mpgw: Ephemeral key decryption failed: *RSA decryption failed*
    mpgw: *RSA decryption failed*

    Could you please help on the below issue

    ------------------------------
    vijendhar soma
    ------------------------------


  • 2.  RE: Decrypt the encrypted data in Datapower.

    User Group Leader
    Posted Wed November 16, 2022 10:21 AM

    Hello vijendhar

    Apologies for the delay - I escalated your question to our team and should have an answer for you today. I will get back to you on it as soon as I can. 

    Thank you



    ------------------------------
    Gabriel Marte Blanco
    Austin TX
    ------------------------------



  • 3.  RE: Decrypt the encrypted data in Datapower.

    Posted Sun November 20, 2022 08:00 AM
    do you have any more log details, I presume your crypto object "crypto-key-pass" is up in the datapower ?
    Could you maybe make a corresponding encryption as well in the same XSLT, just to make sure the keypair matches ? (so encrypt and decrypt directly after)

    ------------------------------
    Tom van Oppens
    ------------------------------