Topic
1 reply Latest Post - ‏2013-05-01T13:26:36Z by RolfRander
6HTV_james_mcvicar
6HTV_james_mcvicar
1 Post
ACCEPTED ANSWER

Pinned topic Decryption error

‏2013-04-24T18:25:14Z |

When encrypting using encrypt key, during my test, I'm using a test string of 'rsb@hotmail.comh', however, when decrypting, the string I get back is 'rsb/hotmain/comh'

I am using Asymentic encryption / decryption, using public private keys

Snippets from the xslt are:

<xsl:variable name="encryptedStringPlain" select="string(dp:encrypt-key('rsb@hotmail.comh','name:pub_key',$encryptionType))"/>


<xsl:variable name="decryptedStringPlain" select="string(dp:decrypt-key($encryptedStringPlain,'name:priv_key',$encryptionType))"/>

The algorithm is www.w3.org/2001/04/xmlenc#rsa-1_5, is there any character replacements or padding that's happening, or is there a way to ensure I get the same string back?

Updated on 2013-04-24T18:26:28Z at 2013-04-24T18:26:28Z by 6HTV_james_mcvicar
  • RolfRander
    RolfRander
    20 Posts
    ACCEPTED ANSWER

    Re: Decryption error

    ‏2013-05-01T13:26:36Z  in response to 6HTV_james_mcvicar

    According to the documentation, encrypt-key() expects output from generate-key() as input. generate-key returns a base64-encoded string. Characters '@' and '.' are not legal base64-characters.

    I assume encrypt-key() tries to base64-decode the input, and replace any illegal input characters with '/'.

    You should never use RSA to encrypt your plain-text. Create a random bit-string as an ephemeral session key, encrypt the key with rsa and encrypt the message with a block-cipher and your session key.

     

    regards, rolf rander