Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Support for signature verification with RSA/DSA public keys #1166
Turns out node didn't support signature verification with anything except for X.509 certificates. This patch takes a guess at inferring whether or not the PEM file passed into crypto.verify() is a public key or certificate, and does the right switch based on that. Minor point I realized after I committed is that sometimes RSA public key headers are just -----BEGIN PUBLIC KEY-----, like DSA, so it's not technically accurate to have the #define C string DSA_KEY_PFX, but, meh.
Lastly, I left this code as-is from crypto:
if (r != 1)
It would probably make sense to kill that off, since it's not really an error if the signature doesn't match. I can either reprepare a pull request, or if you want to just change it as part of the merge. Let me know.