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

Support setting custom OpenSSL parameters #305

Open
mkalam-alami opened this issue Aug 3, 2021 · 3 comments
Open

Support setting custom OpenSSL parameters #305

mkalam-alami opened this issue Aug 3, 2021 · 3 comments

Comments

@mkalam-alami
Copy link

While integrating this library I have been faced with limitations on the pem.verifySigningChain() tool, as I needed to customize the OpenSSL options to make them fit our use case.

It would be overkill to ask for integrating the various OpenSSL options in JSON format, so I'd suggest either:

  • a simple "customOpenSSLOptions" (string[]) param that is merged with the params array
  • a callback instead, that is plugged somewhere to customize the behavior of the spawn wrapper

In the meantime our workaround has been to directly use the internal APIs:

import * as openssl from 'pem/lib/openssl';

function validateCertChain(cert: string, callback: Callback<boolean>) {
    var params = ['verify', '** WHATEVER WE NEED **']
    if (this.certAuthority !== undefined) {
      params.push('-CAfile');
      params.push('--TMPFILE--');
    }
    params.push('--TMPFILE--');

    openssl.spawnWrapper(params, [this.certAuthority, cert], function (err, code, stdout, stderr) {
      // ....
@Dexus
Copy link
Owner

Dexus commented Aug 4, 2021

If you like to contribute, feel free to open a PR.

@Dexus
Copy link
Owner

Dexus commented Jan 20, 2022

Your problem has nothing to do with #303 right?

@mkalam-alami
Copy link
Author

I confirm, my problem wasn't a bug but just a need for customization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants