Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds method to verify a certificate's signing chain #60

Merged
merged 1 commit into from
Aug 26, 2015

Conversation

achingbrain
Copy link
Contributor

I frequently find myself having to validate a given certificate by verifying that it has a valid trust chain and as such that I possess all CA certificates in that signing chain.

Openssl gives us openssl verify -CAfile /path/to/ca.file /path/to/cert.file to do this so this PR adds a function to call openssl verify, docs and some tests to verify that a certificate does indeed have a valid signing chain.

So:

// a CA certificate
var ca = '-----BEGIN CERTIFICATE-----\nU2xvmeQANB0r9V...';

// an intermediate CA, signed by `ca`
var intermediate = '-----BEGIN CERTIFICATE-----\nWqvYOhA8uIpkNc...';

// a certificate signed by `intermediate`
var cert = '-----BEGIN CERTIFICATE-----\zodfM1CAZMCBE...';

pem.verifySigningChain(cert, [ca, intermediate], function (error, valid) {
  console.info('cert chain was valid?', valid);
});

Happy to discuss, make changes, etc.

Dexus added a commit that referenced this pull request Aug 26, 2015
Adds method to verify a certificate's signing chain
@Dexus Dexus merged commit 3bf922b into Dexus:master Aug 26, 2015
@achingbrain achingbrain deleted the add-verify-signing-chain branch October 14, 2015 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants