Skip to content

Commit

Permalink
fix(package): max 20 octets for serial (#141)
Browse files Browse the repository at this point in the history
* fix(package): parse serial and fix getDhparamInfo (#136)

* chore(package): update semantic-release to version 8.0.0

* Add OpenSSL Matrix

* make test use of self builded "/openssl/bin/openssl"

* fix getDhparamInfo

* Fix Tests for Travis and Empty OPENSSL_DIR

* * chore(package): Reviewautomatedtests (#138)

* chore(package): update semantic-release to version 8.0.0

* review tests; standardjs; changelog; grunt removal

* fix(travis): build travis with `npm run test`

* fix(tests): password must be 4 to 1023 characters

* chore(build): move back after build

* fix(package): max 20 octcts for serial

A certificate serial number is not decimal conforming. That is the bytes in a serial number do not necessarily map to a printable ASCII character.
eg: 0x00 is a valid serial number and can not be represented in a human readable format (atleast one that can be directly mapped to the ACSII table).

fix #84
  • Loading branch information
Dexus committed Sep 21, 2017
1 parent bed4f44 commit 8722e77
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/pem.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,14 @@ function createCertificate (options, callback) {
params.push('--TMPFILE--')
if (options.serial) {
params.push('-set_serial')
params.push('0x' + ('00000000' + options.serial.toString(16)).slice(-8))
// set the serial to the max lenth of 20 octets ()
// A certificate serial number is not decimal conforming. That is the
// bytes in a serial number do not necessarily map to a printable ASCII
// character.
// eg: 0x00 is a valid serial number and can not be represented in a
// human readable format (atleast one that can be directly mapped to
// the ACSII table).
params.push('0x' + ('0000000000000000000000000000000000000000' + options.serial.toString(16)).slice(-40))
} else {
params.push('-CAcreateserial')
}
Expand Down

0 comments on commit 8722e77

Please sign in to comment.