auth0/node-samlp

Error: error:0906D06C:PEM routines:PEM_read_bio:no start line

jerryOkafor opened this issue · 1 comments

I am trying to generate smalp response and this is the error I am getting:

Error: error:0906D06C:PEM routines:PEM_read_bio:no start line
at Sign.sign (crypto.js:331:26)
at RSASHA256.getSignature (/srv/node_modules/xml-crypto/lib/signed-xml.js:126:22)
at SignedXml.createSignature (/srv/node_modules/xml-crypto/lib/signed-xml.js:719:44)
at SignedXml.computeSignature (/srv/node_modules/xml-crypto/lib/signed-xml.js:510:29)
at Object.exports.create (/srv/node_modules/saml/lib/saml20.js:204:9)
at getSamlResponse (/srv/node_modules/samlp/lib/samlp.js:72:10)
at execute (/srv/node_modules/samlp/lib/samlp.js:144:7)
at /srv/node_modules/samlp/lib/samlp.js:182:9
at Object.getPostURL (/srv/lib/src/sso/index.js:43:16)
at /srv/node_modules/samlp/lib/samlp.js:178:12
at Object.module.exports.parseSamlRequest (/srv/node_modules/samlp/lib/utils.js:85:28)
at /srv/node_modules/samlp/lib/samlp.js:163:11
at exports.handleSAMLRequest (/srv/lib/src/sso/index.js:66:37)
at Layer.handle [as handle_request] (/srv/node_modules/express/lib/router/layer.js:95:5)
at next (/srv/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/srv/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/srv/node_modules/express/lib/router/layer.js:95:5)
at /srv/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/srv/node_modules/express/lib/router/index.js:335:12)
at next (/srv/node_modules/express/lib/router/index.js:275:10)
at urlencodedParser (/srv/node_modules/body-parser/lib/types/urlencoded.js:82:7)
at Layer.handle [as handle_request] (/srv/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/srv/node_modules/express/lib/router/index.js:317:13)
at /srv/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/srv/node_modules/express/lib/router/index.js:335:12)
at next (/srv/node_modules/express/lib/router/index.js:275:10)
at rawParser (/srv/node_modules/body-parser/lib/types/raw.js:58:7)
at Layer.handle [as handle_request] (/srv/node_modules/express/lib/router/layer.js:95:5)

hard to say if this is what you're running into, but i've had the same error when my private key / cert was in a .env file and had new lines

app was running on heroku which was fine with .env variables with new lines in them, but the local version didn't properly parse them

so if i had this .env

123467
...
8901234
"
OTHER_VAR=123

any code that called process.env.SAML_KEY would only get "-----BEGIN RSA PRIVATE KEY-----" which would then throw this specific error

didn't have a great work around, just pasted the key into my code directly for testing

the process would only get the