Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pem

Package Overview
Dependencies
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pem - npm Package Compare versions

Comparing version 1.12.6 to 1.12.7

test/fixtures/pem196.pem

8

CHANGELOG.md

@@ -0,1 +1,9 @@

## [1.12.7](https://github.com/Dexus/pem/compare/v1.12.6...v1.12.7) (2018-09-11)
### Bug Fixes
* **package:** fix fetchCertificate to list all infos ([3f13a0d](https://github.com/Dexus/pem/commit/3f13a0d)), closes [#196](https://github.com/Dexus/pem/issues/196)
* **package:** fix fetchCertificate to list all infos ([e6a8f3c](https://github.com/Dexus/pem/commit/e6a8f3c)), closes [#196](https://github.com/Dexus/pem/issues/196)
## [1.12.6](https://github.com/Dexus/pem/compare/v1.12.5...v1.12.6) (2018-09-10)

@@ -2,0 +10,0 @@

47

lib/pem.js

@@ -289,2 +289,3 @@ 'use strict'

* @param {Object} [options] Optional options object
* @param {String} [options.serviceCertificate] PEM encoded certificate
* @param {String} [options.serviceKey] Private key for signing the certificate, if not defined a new one is generated

@@ -503,5 +504,7 @@ * @param {String} [options.serviceKeyPassword] Password of the service key

]
openssl.spawnWrapper(params, certificate, function (err, code, stdout) {
openssl.spawnWrapper(params, certificate, function (err, code, stdout, stderr) {
if (err) {
return callback(err)
} else if (stderr) {
return callback(stderr)
}

@@ -560,3 +563,3 @@ return fetchCertificateData(stdout, callback)

openssl.spawnWrapper(params, certificate, function (sslErr, code, stdout) {
openssl.spawnWrapper(params, certificate, function (sslErr, code, stdout, stderr) {
function done (err) {

@@ -576,3 +579,3 @@ if (err) {

helper.deleteTempFiles(delTempPWFiles, function (fsErr) {
done(sslErr || fsErr)
done(sslErr || fsErr || stderr)
})

@@ -598,5 +601,7 @@ })

openssl.spawnWrapper(params, dh, function (err, code, stdout) {
openssl.spawnWrapper(params, dh, function (err, code, stdout, stderr) {
if (err) {
return callback(err)
} else if (stderr) {
return callback(stderr)
}

@@ -664,5 +669,7 @@

openssl.spawnWrapper(params, certificate, function (err, code, stdout) {
openssl.spawnWrapper(params, certificate, function (err, code, stdout, stderr) {
if (err) {
return callback(err)
} else if (stderr) {
return callback(stderr)
}

@@ -834,5 +841,5 @@ var match = stdout.match(/Fingerprint=([0-9a-fA-F:]+)$/m)

openssl.spawnWrapper(params, certificate, function (sslErr, code, stdout) {
openssl.spawnWrapper(params, certificate, function (sslErr, code, stdout, stderr) {
function done (err) {
if (err) {
if (err && err.trim() !== 'verify OK') {
return callback(err)

@@ -853,3 +860,3 @@ }

helper.deleteTempFiles(delTempPWFiles, function (fsErr) {
done(sslErr || fsErr)
done(sslErr || fsErr || stderr)
})

@@ -936,3 +943,3 @@ })

openssl.spawnWrapper(params, files, function (err, code, stdout) {
openssl.spawnWrapper(params, files, function (err, code, stdout, stderr) {
if (err) {

@@ -957,2 +964,4 @@ return callback(err)

var ky, i
// serial

@@ -963,4 +972,12 @@ if ((serial = certData.match(/\s*Serial Number:\r?\n?\s*([^\r\n]*)\r?\n\s*\b/)) && serial.length > 1) {

if ((subject = certData.match(/\s*Subject:\r?\n(\s*((C|L|O|OU|ST|CN|DC|emailAddress)\s=\s[^\r\n]+\r?\n))*\s*\b/)) && subject.length > 1) {
if ((subject = certData.match(/\s*Subject:\r?\n(\s*(([a-zA-Z0-9.]+)\s=\s[^\r\n]+\r?\n))*\s*\b/)) && subject.length > 1) {
subject = subject[0]
tmp = matchAll(subject, /\s([a-zA-Z0-9.]+)\s=\s([^\r\n].*)/g)
for (i = 0; i < tmp.length; i++) {
ky = tmp[i][1].toString()
if (ky.match('(C|ST|L|O|OU|CN|emailAddress|DC)')) {
continue
}
certValues[ky] = tmp[i][2].toString()
}

@@ -1040,4 +1057,12 @@ // country

if ((issuer = certData.match(/\s*Issuer:\r?\n(\s*(C|L|O|OU|ST|CN|DC|emailAddress)\s=\s[^\r\n].*\r?\n)*\s*\b/)) && issuer.length > 1) {
if ((issuer = certData.match(/\s*Issuer:\r?\n(\s*([a-zA-Z0-9.]+)\s=\s[^\r\n].*\r?\n)*\s*\b/)) && issuer.length > 1) {
issuer = issuer[0]
tmp = matchAll(issuer, /\s([a-zA-Z0-9.]+)\s=\s([^\r\n].*)/g)
for (i = 0; i < tmp.length; i++) {
ky = tmp[i][1].toString()
if (ky.match('(C|ST|L|O|OU|CN|emailAddress|DC)')) {
continue
}
certValues.issuer[ky] = tmp[i][2].toString()
}

@@ -1044,0 +1069,0 @@ // country

@@ -13,3 +13,3 @@ {

"description": "Create private keys and certificates with node.js and io.js",
"version": "1.12.6",
"version": "1.12.7",
"repository": {

@@ -16,0 +16,0 @@ "type": "git",

@@ -356,2 +356,44 @@ 'use strict'

})
it('Read CertInformation form ./test/fixtures/pem196.pem', function (done) {
var certInfo = {
issuer: {
country: 'BO',
state: '',
locality: '',
organization: 'ADSIB',
organizationUnit: '',
commonName: 'Entidad Certificadora Publica ADSIB',
dc: ''
},
serial: '2854046357827755658 (0x279b9c0a82d21e8a)',
'1.3.6.1.1.1.1.0': '#0C0734373132323836',
dnQualifier: 'CI',
country: 'BO',
state: '',
locality: '',
organization: '',
organizationUnit: '',
commonName: 'ILSE SILES BECERRA',
emailAddress: '',
dc: '',
validity: {
start: 1524175291000,
end: 1524434491000
},
signatureAlgorithm: 'sha256WithRSAEncryption',
publicKeySize: '2048 bit',
publicKeyAlgorithm: 'rsaEncryption'
}
var d = fs.readFileSync('./test/fixtures/pem196.pem').toString()
pem.readCertificateInfo(d, function (error, data) {
if (data.serial) delete data.serial
if (certInfo.serial) delete certInfo.serial
hlp.checkError(error)
hlp.checkCertificateData(data, certInfo)
hlp.checkTmpEmpty()
done()
})
})
})

@@ -358,0 +400,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc