Hi,
The library (v0.9.0) crashes when a private key is formatted incorrectly. Examples are if the private key is a literal with \n characters, or if the newlines are replaced with spaces.
The following error is thrown:
140014095067008:error:0906D06C:PEM routines:PEM_read_bio:no start line:../deps/openssl/openssl/crypto/pem/pem_lib.c
:703:Expecting: ANY PRIVATE KEY
crypto.js:429
var ret = this._binding.sign(toBuf(key));
^
Error: SignFinal error
at Sign.sign (crypto.js:429:27)
at createRS256Signature (/app/node_modules/gcloud/node_modules/gapitoken/node_modules/jws/index.js:75:58)
at jwsRS256Sign (/app/node_modules/gcloud/node_modules/gapitoken/node_modules/jws/index.js:68:21)
at Object.jwsSign [as sign] (/app/node_modules/gcloud/node_modules/gapitoken/node_modules/jws/index.js:32:12)
at GAPI.getAccessToken (/app/node_modules/gcloud/node_modules/gapitoken/gapitoken.js:56:25)
at GAPI.getToken (/app/node_modules/gcloud/node_modules/gapitoken/gapitoken.js:35:14)
at /app/node_modules/gcloud/lib/common/connection.js:207:10
at process._tickCallback (node.js:419:13)
Also, it would be nice if the library could handle some alternative formats of a private key, like spaces instead of newlines. We're retrieving our private key from a environment variable and environment variables can't be multiline. So right now we have to denote newlines with some character and replace them with newlines in our code.
Kind regards,
Leonard
Hi,
The library (v0.9.0) crashes when a private key is formatted incorrectly. Examples are if the private key is a literal with \n characters, or if the newlines are replaced with spaces.
The following error is thrown:
Also, it would be nice if the library could handle some alternative formats of a private key, like spaces instead of newlines. We're retrieving our private key from a environment variable and environment variables can't be multiline. So right now we have to denote newlines with some character and replace them with newlines in our code.
Kind regards,
Leonard