X509 not defined
Closed this issue · 9 comments
Attempting to verify a JWS using X509:
assert(jws.verifyJWSByPemX509Cert(data, cert));
(not sure if this method is supported fully in your wrapper, it's not documented in the readme)
Trace
.../node_modules/jsjws/lib/jsjws.js:6158
var x509 = new X509();
^
ReferenceError: X509 is not defined
at verifyJWSByPemX509Cert (../node_modules/jsjws/lib/jsjws.js:6158:17)
My use case is basically this page but from node http://kjur.github.io/jsjws/tool_verifyanalyze.html
Let me take a look. I haven't had cause to use this, hopefully it's just a matter of building in the required file from jsjws.
That's going to be slow - the point of this module is kind of to use ursa
(openssl) to do the work on Node. Unfortunately, ursa
only deals with public keys.
There is the pem
module which does extract public keys from certificates. However, it seems to exec openssl
which isn't great. @bvitale are you going to be doing this as part of a service - would using the pem
module suffice?
Not completely qualified to be picky on this one. The pem
module is probably fine for a first pass...
It'd be better if pem
didn't shell out.
However, node-jsjws
just needs the public key, hence my reticence to include certificate handling in there too if it can be done elsewhere.
I think it shouldn't be difficult to expose the X509
class too, or at least a subset. I'll give it a go and update this issue when I'm done.
@bvitale I've just published version 0.6 which provides access to the X509
class.
See https://github.com/davedoesdev/node-jsjws/blob/master/test/cert_spec.js for an example.
I'd be really grateful if you could give it a try and let me know if it works for your use case.
Yes, it works. Verified a JWS issued by Windows Azure Active Directory. Tested on Ubuntu 12.04.
Fantastic, thanks.
Closing this as it resolved the issue.