0

As I learned in a previous post, Google Apps Script doesn't have any utilities, services or existing libraries to execute RSA encryption/decryptions:

I added a new class to my Apps Script project based on a JavaScript library for RSA. It works, but always reach the 30s execution time limit with normal RSA key sizes. If I use a key size bigger that 384 bits, the script always get a timeout. 384 bits encryption take almost 6 sec, and decryption take more than 20 sec.

How can I achieve my goal and bypass the 30 sec execution limitation? Is there a way to increase the CPU and memory resources for my script, or any useful suggestion to improve performance for encryption and decryption?

Maybe a background job could be use to encrypt and decrypt content, but I found nothing on that for Gmail Add-ons

tehhowch
  • 9,645
  • 4
  • 24
  • 42
Cédric Boivin
  • 10,854
  • 13
  • 57
  • 98
  • 2
    I've added the `gmail-addons` tag since your previous related questions were about Gmail Add-ons, and that environment brings with it more restrictions than non-addon Apps Script projects. @Cedric Feel free to revert that change if my intuition is incorrect. – tehhowch Aug 30 '18 at 14:38
  • @tehhowch thanks for your modification's it's appreciated – Cédric Boivin Aug 30 '18 at 16:27
  • Perhaps you can benchmark a few other Javascript RSA implementations to make certain the problem isn't with the implementation. – President James K. Polk Aug 30 '18 at 19:18
  • 1
    @JamesKPolk already done, i try about 3 or 4 differents library. Always the same problem. The major problem seem came from the BigInteger variable ... – Cédric Boivin Aug 30 '18 at 19:28
  • Although I'm not sure whether this is a direct solution, can I ask you about the situation you want to use the script? In your situation, 1. Users use RSA encryption/decryptions using Google Docs and browser. 2. Users use it using Web Apps and the installed trigger. If in the case of the former, you can use Javascript. So the process speed will be high. If in the case of the latter, you are required to use GAS. In this case, I think that it is required to replace the methods with high process cost to low one. – Tanaike Aug 30 '18 at 23:14
  • @Tanaike Actually, I use it in an Addon Gmail. I already have a library that works fine with javascript and the browser, but unless I'm wrong, there's no way to inject a Javascript library into a Gmail Addon and interact with the content of an email? Obviously, the user must install the addon and give the execution permissions. – Cédric Boivin Aug 31 '18 at 11:46
  • Thank you for replying. In the case of Gmail addon, the sidebar using custom HTML cannot be used. This might be due to the security. So in this case, the process cost of the script of GAS side is required to be reduced. I'm measuring benchmark of several methods for such situations. I create the GAS applications using this data. Is such data useful for your situation? https://github.com/tanaikech/taking-advantage-of-google-apps-script#Benchmarks – Tanaike Aug 31 '18 at 23:24

0 Answers0