cipher in Process -> decipher in WI

343 views
Skip to first unread message

J.M.

unread,
Dec 13, 2016, 3:48:33 AM12/13/16
to Fujitsu RunMyProcess Developer Community
Hi,


I have a question about the cipher/decipher functions.
I need to save some data in a collection and I want to cipher before saving, and then store the ciphered data. I have seen a cipher function in freemarker for this.

Once this is done, I have a Web Interface where I need to query some of this ciphered data, so I need to query my collection in JS, decipher data in JS and then show it in the WI. However the cipher/decipher functions I've seen are used from freemarker, and because of my needs, I would need to cipher in a process from freemarker and after that, decipher in a WI from JS.


How can I achieve it?


Thank you very much in advance,
Best regards.

Pankaj Kumar

unread,
Dec 13, 2016, 4:52:43 AM12/13/16
to Fujitsu RunMyProcess Developer Community
Hi Javier,

No direct method to decipher the text is available in java script (like in freemarker API), so you can achieve this by either of following two approach:-
  • Please create a Composite API (CAPI) to fetch the collection data sending query in input parameter of CAPI and decipher it using freemarker method and return result.
  • You can use any third party js library to decipher the data and include this in web-interface.

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/492c71d4-7b44-47fd-9d0b-d3fbd635362d%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

javiermm...@gmail.com

unread,
Dec 13, 2016, 5:12:30 AM12/13/16
to Fujitsu RunMyProcess Developer Community
Thank you Panjak.

In order to make the CAPI, I would need the possible values for the string algorithm (for both cipher and decipher). If I choose the options in the doc they are not recognized (I attach a sample code I've tried and the console result)

________
__CODE__

<#assign key = generate_key("fujitsu")>
<#assign cadena = "hola mundo!">
<#assign algo = "CBC">
<#assign cadenaCifrada = cipher(cadena, key, algo)>

${cadena}
${cadenaCifrada}

<#assign registro>
{"cifrado" : ${cipher(cadena, key)}, "original" : "${cadena}"}
</#assign>

${registro}


____________
___RESULT___
Error while processing <#assign key = generate_key("fujitsu")>
<#assign cadena = "hola mundo!">
<#assign algo = "CBC">
<#assign cadenaCifrada = cipher(cadena, key, algo)>

${cadena}
${cadenaCifrada}

<#assign registro>
{"cifrado" : ${cipher(cadena, key)}, "original" : "${cadena}"}
</#assign>

${registro}
java.security.NoSuchAlgorithmException: Cannot find any provider supporting CBC


So, How can I cipher and decipher choosing (the same) algorithm?

Thanks again and regards.


On Tuesday, December 13, 2016 at 10:52:43 AM UTC+1, Pankaj Kumar wrote:
> Hi Javier,
>
>
> No direct method to decipher the text is available in java script (like in freemarker API), so you can achieve this by either of following two approach:-
> Please create a Composite API (CAPI) to fetch the collection data sending query in input parameter of CAPI and decipher it using freemarker method and return result.
> You can use any third party js library to decipher the data and include this in web-interface.
>
>
>
>
>
> Thank you,
> Pankaj Kumar
> Fujitsu RunMyProcess Support
>
>
> On Tue, Dec 13, 2016 at 2:18 PM, J.M. <javiermm...@gmail.com> wrote:
> Hi,
>
>
>
>
>
> I have a question about the cipher/decipher functions.
>
> I need to save some data in a collection and I want to cipher before saving, and then store the ciphered data. I have seen a cipher function in freemarker for this.
>
>
>
> Once this is done, I have a Web Interface where I need to query some of this ciphered data, so I need to query my collection in JS, decipher data in JS and then show it in the WI. However the cipher/decipher functions I've seen are used from freemarker, and because of my needs, I would need to cipher in a process from freemarker and after that, decipher in a WI from JS.
>
>
>
>
>
> How can I achieve it?
>
>
>
>
>
> Thank you very much in advance,
>
> Best regards.
>
>
>
> --
>
> Fujitsu - RunMyProcess
>
> ---
>
> You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
>

> To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.

Pankaj Kumar

unread,
Dec 13, 2016, 6:00:37 AM12/13/16
to Fujitsu RunMyProcess Developer Community
Hi Javier,

Please try with default algorithm (AES). 

Sample Code:-
<#assign key1 = generate_key("fujitsu")>
<#assign cadena = "hola mundo Pankaj Test!">
<#assign cadenaCifrada = cipher(cadena, key1)>
<#assign origText = decipher(cadenaCifrada.ciphered, cadenaCifrada.iv, key1)>
${origText}

Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.

javiermm...@gmail.com

unread,
Dec 13, 2016, 6:13:15 AM12/13/16
to Fujitsu RunMyProcess Developer Community
Hi Pankaj,

Yes, it works with default algorithm, but:
1 - What about the others?
2 - After making som test, I think it is necessary to store in my collection not only the ciphered value but also the iv and the key, right? I thought the same password would return always the same key, but it does not seem so.


Thank you again and regards.

javiermm...@gmail.com

unread,
Dec 14, 2016, 3:25:29 AM12/14/16
to Fujitsu RunMyProcess Developer Community, javiermm...@gmail.com
Hi again,



I have a new issue related to this.
I have choosen the CAPI way to include the decipher function in my WI and I want to show the deciphered data in a report widget, so I though:

"I will need to add a calculated column in my report widget in which I will invoke the function to trigger my CAPI (trigger function of the RMP API) in order to get the deciphered data, and then I will only need to show this result".

However, the way in which the trigger function works is with callback functions, that is, I cannot get the deciphered data outside my callback function, so I cannot invoke my CAPI in a calculated column of my report widget for getting and showing it in my column.

Please, could you help me with that? How could I show my deciphered data in a report widget? What would the correct 'flow' for getting this? ¿Is there another way for return the result of my capi in a variable I could use?



Thank you in advance and regards.

Pankaj Kumar

unread,
Dec 14, 2016, 6:18:42 AM12/14/16
to Fujitsu RunMyProcess Developer Community, Javier Martín
Hi,

Please create a JS report to achieve this functionality as "js column" (calculated column) for small computation i.e. formatting of data,  some calculation based on other column data.

Please find reference link below for js report below:-


Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
Message has been deleted

javiermm...@gmail.com

unread,
Dec 14, 2016, 7:15:57 AM12/14/16
to Fujitsu RunMyProcess Developer Community, javiermm...@gmail.com
Hi Pankaj,


I don't understand the need of a JS report in my case.
I mean on one hand, I need the report capabilities it already has like sort, filters, etc (in fact, what I'm trying is to modify only one column, for showing his deciphered version), and with a JS report I would need to implement them (The implementation of the CAPI used in the link of your previous post is not included).

On the other side, supose I have these features already implemented, when I try to make the call to my decipher CAPI, I would be in the same situation, right? I would have my result in callback functions and I cannot get them in the outside of that functions.

So, It seems to be the same case but with a lot of additional work to do, isn't it?



Best regards

Pankaj Kumar

unread,
Dec 14, 2016, 7:41:05 AM12/14/16
to Fujitsu RunMyProcess Developer Community
Hi, 

To decipher the text in a report column,you need to do it using some  javascript library (on client machine) that support the  AES algorithm. If you want to do it using CAPI(Composite API), then you will need a js report and the CAPI you designed will return the whole report data (including decipher text), all decryption will be done in CAPI. I agree it will require you to code more (both js code and CAPI design).

If you need more support on this, Please contact our sales team to discuss the support options available. 


Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support

To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.

javiermm...@gmail.com

unread,
Dec 14, 2016, 7:47:35 AM12/14/16
to Fujitsu RunMyProcess Developer Community
OK, Pankaj.



It's a little clearer now for me.
There is only one thing I'm not sure about, and I will need to know it in order to use a JS library.
Which kind of AES algorithm is used by the RMP's decipher function by default?
After a little search, I've found so many: CTR, CBC, CFB, OFB, ECB...)



Thank you very much
Regards.

J.M.

unread,
Dec 28, 2016, 3:31:16 AM12/28/16
to Fujitsu RunMyProcess Developer Community, javiermm...@gmail.com
Hi again,

First of all Merry Christmas to everyone and happy holydays. I hope you are having a good time.

Regarding to the post, I would like to update my situation.
Making a brief recap, I have some data I need to cipher and save in a collection, and after that I need to show this data deciphered in a report widget maintaining the filters, ordering and all the features of a report widget. So:
1- I'm still waiting for some info about the cipher process. I need to know how to decipher with JS a ciphered string in RMP.
2 - Meanwhile, I have built a capi with the data query required for filling a JS report. The query is choosen in base to the report criteria. Deciphering de ciphered data in the capi I have clean results to show in my report, as Pankaj said, thanks to having saved the key and the iv. However, due to the way in which the cipher function works (not accepting an initialization vector), the cipher function returns always a different result with the same key (due to the iv). So I cannot re-cipher the data shown in my report in order to search in my collection, since it will never be the same result, and for this reason I'm "loosing" the filter function. It is not really lost but it will never find a coincidence.


How can I solve this problem? Is my requirement so weird?
Is it possible to achieve my requirement?


Thanks again and regards.

Richard Manga

unread,
Jan 5, 2017, 5:35:45 AM1/5/17
to suppor...@runmyprocess.com, Javier Martín
Good morning Sir,
Please, instead of trying to use cipher/decipher functions in javascript, use CAPI (Composite API).
You can call composite API directly from your javascript, then you will be able to process your data on server side 
and send back the result to the user.
If you have any other question, please don't hesitate to contact us.
Regards,
Richard



Richard Manga

Support & Training Manager

RunMyProcess


              rmanga@runmyprocess.com

                   +33 (0) 1 75 77 51 82

                          +33 (0) 6 74 75 01 24


3 rue de Gramont

75002, Paris, France.

www.runmyprocess.com

img-275-180-2 img-275-180-2






To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.

To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
Reply all
Reply to author
Forward
0 new messages