Shiv Yadav
Shiv Yadav

Reputation: 311

Invalid argument: key error in Utilities.computeRsaSha256Signature

I tried the below code in my code.gs. I'm getting an error.

  let privatekey = 'IcA3+ZwPmUMtAou4f9hJMg==';
  var key = `-----BEGIN PRIVATE KEY-----\n${privatekey}\n-----END PRIVATE KEY-----\n`;
  console.log(key)

  var signature = Utilities.computeRsaSha256Signature("this is my input", key);
  Logger.log(signature);

In the console I'm getting the key:

-----BEGIN PRIVATE KEY-----
IcA3+ZwEmUMtAou4f9hHMg==
-----END PRIVATE KEY-----

Error: Exception: Invalid argument: key

I have attached the ss of the error. Can anyone help me with this error? why it's coming? Error Image

Upvotes: 0

Views: 280

Answers (0)

Related Questions