Skip to content

Commit

Permalink
fix: Merge pull request #234 from pvangeepuram/fix-serviceKeyPassword…
Browse files Browse the repository at this point in the history
…-issue

Fix the issue with generating certificate with serviceKeyPassword
  • Loading branch information
Dexus authored Feb 16, 2019
2 parents 1b63519 + 2248228 commit 1649e7b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pem.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,15 +395,15 @@ function createCertificate (options, callback) {
}
}
if (options.serviceKeyPassword) {
helper.createPasswordFile({ 'cipher': '', 'password': options.serviceKeyPassword, 'passType': 'in' }, params, delTempPWFiles[delTempPWFiles.length])
helper.createPasswordFile({ 'cipher': '', 'password': options.serviceKeyPassword, 'passType': 'in' }, params, delTempPWFiles)
}
tmpfiles.push(options.serviceCertificate)
tmpfiles.push(options.serviceKey)
} else {
params.push('-signkey')
params.push('--TMPFILE--')
if (options.serviceKeyPassword) {
helper.createPasswordFile({ 'cipher': '', 'password': options.serviceKeyPassword, 'passType': 'in' }, params, delTempPWFiles[delTempPWFiles.length])
helper.createPasswordFile({ 'cipher': '', 'password': options.serviceKeyPassword, 'passType': 'in' }, params, delTempPWFiles)
}
tmpfiles.push(options.serviceKey)
}
Expand Down
12 changes: 12 additions & 0 deletions test/pem.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,18 @@ describe('General Tests', function () {
})
})

it('create cert using serviceKeyPassword', function (done) {
pem.createCertificate({
serviceKeyPassword: 'min4chars',
selfSigned: true
}, function (error, data) {
hlp.checkError(error)
hlp.checkCertificate(data, true)
hlp.checkTmpEmpty()
done()
})
})

it('create cert using pkey w/ password; create pkcs12', function (done) {
pem.createCertificate({
clientKey: pwkey.key,
Expand Down

0 comments on commit 1649e7b

Please sign in to comment.