How to Decrypt Squire Editor widget data

  • Profile Image
    lcuwebmaster
    Asked on March 05, 2018 at 05:45 PM

    Does anyone know how to get the widget_metadata from the squire editor widget back into html code.  I'm using the jotform api to pull data but all it is giving me is a random code.

  • Profile Image
    John_Benson
    Answered on March 05, 2018 at 08:15 PM

    For API support, please email them at this link: api@jotform.com

    Thank you.

  • Profile Image
    lcuwebmaster
    Answered on March 06, 2018 at 08:52 AM

    It is not only with the api but also sending post data at the end of the form.  I was using the api as an example of how to find it.

  • Profile Image
    TREVON
    Answered on March 06, 2018 at 10:16 AM

    If you need to send Post data at the end of form kindly follow the guide below:

    https://www.jotform.com/help/71-Prepopulating-Fields-to-Your-JotForm-via-URL-Parameters

    Below are related guides:

    https://www.jotform.com/help/146-How-to-Find-Field-IDs-and-Names

    https://www.jotform.com/help/213-Send-Submission-Data-via-Post-Method-and-Thank-You-Settings

    Kindly do let us know if you need further assistance.

  • Profile Image
    lcuwebmaster
    Answered on March 06, 2018 at 10:33 AM

    Yes I already have the post data being sent but this is what I am seeing with the post data - 

    [message] => {"widget_metadata":{"type":"htmltext","value":"PGRpdj5NeSBvd24gbWVzc2FnZSB3aXRoIHN0dWZmPGJyPjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+b3RoZXIgbGluZXM8YnI+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj48YSB0YXJnZXQ9Il9ibGFuayIgaHJlZj0iaHR0cHM6Ly9sY3UuZWR1Ij5hbmQgYSBsaW5rPC9hPjwvZGl2PgoKPGRpdj48YnI+PC9kaXY+"}}

    I need to know how to read that from the squire widget?
  • Profile Image
    TREVON
    Answered on March 06, 2018 at 11:32 AM

    Apologies for the back an forth. From your explanation i have understood that you need to decode the encoded data form the "Squire Widget".

    ""PGRpdj5NeSBvd24gbWVzc2FnZSB3aXRoIHN0dWZmPGJyPjwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+b3RoZXIgbGluZXM8YnI+PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj48YSB0YXJnZXQ9Il9ibGFuayIgaHJlZj0iaHR0cHM6Ly9sY3UuZWR1Ij5hbmQgYSBsaW5rPC9hPjwvZGl2PgoKPGRpdj48YnI+PC9kaXY+"}} "

    Upon further check it seems like this Squired Editor is encoding text in base64 string.

    Depending on the language you are using, you should find a method built-in on that language that can decode base64 strings. This way the gibberish text will be converted to readable text.

    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.
     

  • Profile Image
    lcuwebmaster
    Answered on March 06, 2018 at 11:41 AM

    Yes, this is the info I needed.  Thank you