arduino-create-agent icon indicating copy to clipboard operation
arduino-create-agent copied to clipboard

signatureKey will not be decoded correctly

Open tantalate opened this issue 6 years ago • 4 comments

I am assigning signatureKey as one-line string with \n replacing all line breaks, but the \n is read as \\n in the signatureKey string, and thus pem.Decode([]byte(*signatureKey)) would failed to decode the key. How should I assign the signatureKey?

tantalate avatar Sep 17 '18 11:09 tantalate

@tantalate this is quite strange since it used to work exactly as you describe (like here https://github.com/arduino/arduino-create-agent/issues/149#issuecomment-301824017). @matteosuppo any idea?

facchinm avatar Sep 17 '18 14:09 facchinm

@tantalate this is quite strange since it used to work exactly as you describe (like here #149 (comment)). @matteosuppo any idea?

Yes, it used to work in 1.1.71, but not working in 1.1.76.

I think it might be introduced by updates of go-ini/ini package.

I have tried to split the key into multiple lines and enclose it in back quotes and it worked.

Thank you!

tantalate avatar Sep 17 '18 15:09 tantalate

Great! Would you mind adding an example of the config for future reference? And sorry for the regression, we'll notify third party users (OpenRoberta for example) about this.

facchinm avatar Sep 17 '18 15:09 facchinm

The signatureKey could be set like this:

signatureKey = `-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAty9EIVIY666Wxst7npCA
vPAqAjjbSNNk8b3Bkzfs1jtkGYAhXTSI7Cg9oCiuZWXbhAL9+Q9riWxOSZ5r3O1E
FAVfEIrMFByBSBjyOggUKu/v8XbdWrNHhe4Y6XeJ0cnAygeqL/130szEEbBB3yj+
AJr+UMLRhBy6Cz7fWBfXaBE0NMLHnlC/yQJsf+PsLclFs2Tqvdq7mL8keZHZGI5p
0dCjo26RDj+XeT+R/Wmo/rf77stCOcKhdc1pRB9blZkQVemisxN0aX1O4IldkP5A
iruAyPN3WW06hobsIcGVrPZAznSdsTvlMnrRgJrND0Zut6ZjiqujJxy7AVaRiOr1
FQIDAQAB
-----END PUBLIC KEY-----`

tantalate avatar Sep 18 '18 01:09 tantalate