How to decrypt form data through API

  • Tim
    Asked on June 11, 2020 at 4:40 PM

    This question has been posted several times before and still no answer or solution -

    Just run this google search and see how many times this has been queried - "how to decrypt data from jotform"

    What good is have an online form that collects data, encrypts the data, emails me the encrypted data, but has no way (API or encryption method) for me to decrypt the data on my own computers and import into my database and or applications?

    Why would anyone want to have go back to your website and have your server decrypt the form data where it is only viewed in a browser?

    That's completely useless!

    We're not going to retype the form data into our application!


    Just tell me the encryption method and I'll write my own routines.


  • Elton Support Team Lead
    Replied on June 11, 2020 at 7:28 PM

    I assume you're referring to the client-side encryption (Encrypt Form Data) feature. Note that it is only you who can decrypt the data using your private key file. There's no way we could decrypt the data for you since your private key file is only saved in your browser and not on our server.

    You can actually decrypt the data on your end without logging in to JotForm. Simply fetch the data with API, revert the base64 encoding to binary, and decrypt it with OpenSSL.

    Example:

    Lets assume your data is in a file called "encrypted.field"

     ➜  cat encrypted.field

    vg89vZgwY3yu55W5j4wFnEQ6ugbg15MH0wq+gu8YXNJvBSiqvVgny+nQjXJEE4lS7LO2MLWn8qw1asnnH0LHfP/f/c9zajEmF4NSihk2P8cZ1U+WmmfiCdyU2UbkSjTl3boT+uYQvNo9mSsgSkga3MEbaHuCcTLuQcTwQBUo039L+gv7mMJxQoD3hHM6i1gQhONch/swWXJzqpV4iVYzboqMtWujo+l60L7C7cy4FiVUUHLhL62dNmT6vAaWaFG5Fh2NnPVwxqWYQhCniJ9qqzdOMYyjWD8uUDjXArNAuzXljaZThoxVURvmKz3xNb4z8kW9gJd2CPSO0PBcuwFJ2Q==

    Pipe base64 decoded data to OpenSSL in Decryption mode

    ➜  base64 -D encrypted.field | openssl rsautl -decrypt -inkey jotform.key

    My super secret data!

    You can also use PHP, NodeJS or any other programming languages to decrypt your data.

    Example in PHP

    https://gist.github.com/eeertekin/f256665d6ef8b463d8e662477fbe5581

    If you have any questions, let us know.