I’m writing a custom authorization system similar to OAuth as a Meteor package.
As part of the authorization I authenticate a SAML Signature using a pem certificate.
-
The package loads the pem file as a static asset on the server.
-
The server loads the file by creating a new Buffer with Assets.getText or Assets.getBinary, but fails when authenticating.
//FAILS:
const cert = new Buffer( Assets.getBinary(‘private/test.pem’) );
const cert = new Buffer( Assets.getText(‘private/test.pem’).toString(‘binary’) ); -
When I test the package with vanilla node, while using
fs
to load the pem file it works://WORKS:
const cert = new Buffer( fs.readFileSync(‘private/test.pem’) );
It seems like Meteor’s Assets api makes a change to the file that makes the certificate invalid when authenticating the signature.
Any ideas on what might cause this behaviour?