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

password is getting requested #159

Closed
KaiSchwarz-cnic opened this issue Oct 6, 2017 · 1 comment
Closed

password is getting requested #159

KaiSchwarz-cnic opened this issue Oct 6, 2017 · 1 comment

Comments

@KaiSchwarz-cnic
Copy link
Contributor

KaiSchwarz-cnic commented Oct 6, 2017

somewhere between pem v1.9.7 and 1.12.0 had been a breaking change.
I expect this to be a result of switching to the password file logic.

I upgraded our internal library to pem's most current release and tests are failing.
I'll try to figure out the reason and where it happens.

I'll keep this issue updated. From my first impression it looks like that in the past some error might be returned in case a password was required, but not provided.

Method: readPkcs12

  pem.readPkcs12(pathname, {
      p12Password: passphrase || ''
  }, function(p_err, p_d) {
     if (p_err)
        resolve(p_err);//<--- this seems no longer to be working correctly in case no passphrase was provided
     else
       resolve(p_d);
  });

tracked this further down:

if (options.p12Password) {
    helper.helperCreatePasswordFile({'cipher': '', 'password': options.p12Password, 'passType': 'in'}, args, delTempPWFiles[delTempPWFiles.length])
  }

args stays unchanged in case given password is empty, in version 1.9.7 args included: '-passin', 'pass:' + options.p12Password.

The main reason seems to be the line
if (options.p12Password) {
which wouldn't be truthy in case of an empty string.

and in case that line is commented out, the helper method also doesn't change anything because this line would then lead to return false

if (!(options.password && options.passType)) {
    return false
  }

In case I fix both parts as necessary, it looks like an empty file is not allowed/recognized as password input. Thus it must be handled in the way of mustPass option.

Best
Kai

@KaiSchwarz-cnic
Copy link
Contributor Author

I'm preparing a PR...

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

No branches or pull requests

1 participant