Skip to content

Commit 1649e7b

Browse files
authored
fix: Merge pull request #234 from pvangeepuram/fix-serviceKeyPassword-issue
Fix the issue with generating certificate with serviceKeyPassword
2 parents 1b63519 + 2248228 commit 1649e7b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/pem.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -395,15 +395,15 @@ function createCertificate (options, callback) {
395395
}
396396
}
397397
if (options.serviceKeyPassword) {
398-
helper.createPasswordFile({ 'cipher': '', 'password': options.serviceKeyPassword, 'passType': 'in' }, params, delTempPWFiles[delTempPWFiles.length])
398+
helper.createPasswordFile({ 'cipher': '', 'password': options.serviceKeyPassword, 'passType': 'in' }, params, delTempPWFiles)
399399
}
400400
tmpfiles.push(options.serviceCertificate)
401401
tmpfiles.push(options.serviceKey)
402402
} else {
403403
params.push('-signkey')
404404
params.push('--TMPFILE--')
405405
if (options.serviceKeyPassword) {
406-
helper.createPasswordFile({ 'cipher': '', 'password': options.serviceKeyPassword, 'passType': 'in' }, params, delTempPWFiles[delTempPWFiles.length])
406+
helper.createPasswordFile({ 'cipher': '', 'password': options.serviceKeyPassword, 'passType': 'in' }, params, delTempPWFiles)
407407
}
408408
tmpfiles.push(options.serviceKey)
409409
}

test/pem.spec.js

+12
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,18 @@ describe('General Tests', function () {
195195
})
196196
})
197197

198+
it('create cert using serviceKeyPassword', function (done) {
199+
pem.createCertificate({
200+
serviceKeyPassword: 'min4chars',
201+
selfSigned: true
202+
}, function (error, data) {
203+
hlp.checkError(error)
204+
hlp.checkCertificate(data, true)
205+
hlp.checkTmpEmpty()
206+
done()
207+
})
208+
})
209+
198210
it('create cert using pkey w/ password; create pkcs12', function (done) {
199211
pem.createCertificate({
200212
clientKey: pwkey.key,

0 commit comments

Comments
 (0)