Decrypt JotForm Post Data with PHP

  • Profile Image
    Asked on November 08, 2016 at 03:53 PM


    I need to post our form to a php script and do some additonal processing on the data.  One of the fields is SSN, so we were told we have to encrypt the form. First off, is that accurate. If it's not, then the rest of this question is not necessary. 

    We are unable to decrypt the post data on our end. I have created a key pair and successfully encrypted and decrypted data with it. Then I add our public key to jotform and send the post data across, but it will not decrypt it. It won't event decrypt the data inside of jotform.

    So I then tried having jotform create the keys and then use the jotform private key to decrypt the post data, but I get the same result.  Do you have examples of how to decrypt the post data? Are you encoding the encrypted data before posting? Any help would be appreciated.


  • Profile Image
    Answered on November 08, 2016 at 09:08 PM

    Thank you for contacting us.

    Here is an answer from our developers from a similar thread:

    On encrypted forms, we're using the RSA algorithm which is the most widely-used public key cryptography algorithm in the world.  
    We don't have any chance to decrypt your data. Your private key is  generated on your own browser, and stored in your computer. It never reaches to our servers.
    You should create your own solution to decrypt the data on your end. Simply fetch the data with API, revert the base64 encoding to binary, and decrypt it with OpenSSL.
    Lets assume your data is in a file called "encrypted.field"
    ➜  cat encrypted.field
    ## Pipe base64 decoded data to OpenSSL in Decryption mode
    ➜  base64 -D encrypted.field | openssl rsautl -decrypt -inkey eee.key
    My super secret data!
    You can use PHP, NodeJS or any other programming languages to decrypt your data.
    ## Example in PHP
    class Decryption { public $privateKey = '{yourPrivateKey}'; public function decrypt($data) { if (openssl_private_decrypt(base64_decode($data), $decryptedData, $this->privateKey))
    return $decryptedData; return "Decryption failed!"; } }
    For more details, you can check the openssl_private_decrypt function in PHP Manual.

    If you need any further assistance, please let us know.

  • Profile Image
    Answered on November 09, 2016 at 06:07 PM

    I got it working! Thanks!