Jump to content









Photo

Problem with Google suite tutorial

google docs public keys

  • Please log in to reply
1 reply to this topic

#1 hipopotamo

hipopotamo

    Newbie

  • Members
  • Pip
  • 1 posts

Posted 22 May 2017 - 05:53 AM

I'm following the Integrate with G-suite tutorial and apparently I'm having trouble with the private and public keys.

 

The tutorial asks to create a public key from the private key on the downloaded json file

 

I stored the private key on a file key.cem (converted all \n to actual carriage returns) and ran:

openssl pkey -in key.pem -pubout -out pubkey.pem

This gave me a public key. I converted the carriage returns to \n so the key would be single line

 

I made all relevant substitutions on the sample code. In particular, I'm substituting this for the keys

String SERVICE_ACCOUNT_PRIVATE_KEY = "-----BEGIN PRIVATE KEY-----\nMII ... KBU=\n-----END PRIVATE KEY-----\n";

String SERVICE_ACCOUNT_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIj...QAB\n-----END PUBLIC KEY-----\n";

 

I set up a debug email account and inserted raw strings on the spreadsheet.

When I run the code in the Carriots Console I get the following two exceptions:

 

Message: Error en requestToken: Exception: Exception raised: java.security.InvalidKeyException: IOException: DerInputStream.getLength(): lengthTag=111, too big. Caused by: IOException: DerInputStream.getLength(): lengthTag=111, too big. sun.security.x509.X509Key.decode(X509Key.java:397)

 

Message: Business logic error: Exception: Exception raised: No such property: token for class: RestrictedScript

 

I think the problem has to do with the keys.

 

Am I copying them correctly? Shall I use the BEGIN END headers? Shall I use the \n characters or simply ignore them?

Many thanks for any help

 

 

 



#2 Yoleon

Yoleon

    Sugar Master

  • Members
  • PipPip
  • 27 posts

Posted 24 May 2017 - 12:06 PM

Hi Hipopotamo,

 

You only need to put the keys in his variables like that,

 

String SERVICE_ACCOUNT_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAxfghfgxxffgxnfngnfxnghnghgxhSHmT2ePTTVKVme\nV4Q6opuCo1npGdumlC9jDNBv9kiigNyHICV04rP089PoB2l0G6S+f5Wvj6JUmniP\nUwSaRUDc/Qap1gOEA9tZLkvklTETrhmxuB1jFF0srpqZE1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M1w0/ljh2VPtL9F/GvZy5qYga+2tEyEZOY/2niO1dKHFzJgjdVCgm\nI8rKZW2WSAAtcgbgffghfddfhsKcw==";

 

I wait for your answer,

 

Yoleon







Also tagged with one or more of these keywords: google docs, public keys

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users