Decrypting encrypted submission using API + python

  • aspirewithesa
    Asked on June 20, 2020 at 4:40 AM

    Dear JotForm support,

    I am trying to decrypt an encrypted form using your API and python, but I am not successful. I have the generated jotform.key file, but it seems that when decrypting, responses are truncated.

    For example, one of the answers in my original form reads:

    "Provide a description on the entity, relevant areas of activity, experience, products / services, key customers and any other information that can help understand why you are the right entity(ies) to bring the proposed innovation to market."

    Now the form is submitted, and I get the encrypted value of this message through API. Using python's RSA module I created the following code:

    private_key_object = RSA.importKey(private_key)
    dec_message = private_key_object.decrypt(enc_message)
    print(dec_message)

    Where enc_message is the read encrypted submitted message and private_key is the content of the jotform.key file.

    What I get as a result is

    \x02'\x8f\xa0/\xc6j7\x82\xf6\x93\xb5\xcb\xe5\x9aN\xb0\xa4$\xa7\xda[\xc2\x8cl\x9f\xdd\xf3\xc8a\x133\x0fK5\x06\x0e\xa7WR\xf1Lw\xc6\x88N\x14\x9e\x95\xce\xcb\xba\x06,\xf2s9\x13\x99\xd2;\x0c\x19<W\xd1\xec2\xb2\x0c\xad\xb8\xfe&|w\x18\xbc\xc1\xae\x1e\xc6J\xb3\xb9~\xbe\xe2\x18\x85\xc4\xa4^It\x9d\x9f\xa9\xac\xeb\x86\xfc\x02\x81\xb3N\xe3f\x90g\x9f\xef\xb5A\x19\xc7\x02Ru\x99\xc5w\xdcq\xa4\xeb`\xc5{-w?m\x1e\x86\x83\xae\x00jotform_untitled_markdownProvide%20a%20description%20on%20the%20entity%2C%20relevant%20areas%20of%20activity%2C%20exp

    If I clean the escape sequences, the final text looks like

    "Provide a description on the entity, relevant areas of activity, exp"

    which is not the full message. I am sure I am doing something wrong, bu I cannot figure out what exactly.

    Would you be able to provide some help? for our project, PHP is not an option

    Thanks in advance.

  • Kenneth JotForm Support
    Replied on June 20, 2020 at 10:20 AM

    Thank you for reaching support,

    Apologies for the inconvenience, unfortunately, using python to decrypt data is not possible.

    For a more detailed explanation please see this related Support Ticket: https://www.jotform.com/answers/2100615-Decrypting-via-API-Python-

    Let us know if you have any further questions.

    Best.

  • aspirewithesa
    Replied on June 21, 2020 at 9:06 AM

     Dear Kenneth_C,

    Thanks for your answer. It has to be possible, since I have been able to decrypt a portion of the message... I will continue trying to figure that out, but if there are any tips you can provide, that will be greatly appreciated.

    Thanks!