node-forge 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/pem.js CHANGED
@@ -106,8 +106,15 @@ pem.decode = function(str) {
106
106
  break;
107
107
  }
108
108
 
109
+ // accept "NEW CERTIFICATE REQUEST" as "CERTIFICATE REQUEST"
110
+ // https://datatracker.ietf.org/doc/html/rfc7468#section-7
111
+ var type = match[1];
112
+ if(type === 'NEW CERTIFICATE REQUEST') {
113
+ type = 'CERTIFICATE REQUEST';
114
+ }
115
+
109
116
  var msg = {
110
- type: match[1],
117
+ type: type,
111
118
  procType: null,
112
119
  contentDomain: null,
113
120
  dekInfo: null,
package/lib/x509.js CHANGED
@@ -1372,6 +1372,8 @@ pki.certificateFromAsn1 = function(obj, computeHash) {
1372
1372
 
1373
1373
  // handle issuer, build issuer message digest
1374
1374
  var imd = forge.md.sha1.create();
1375
+ var ibytes = asn1.toDer(capture.certIssuer);
1376
+ imd.update(ibytes.getBytes());
1375
1377
  cert.issuer.getField = function(sn) {
1376
1378
  return _getAttribute(cert.issuer, sn);
1377
1379
  };
@@ -1379,7 +1381,7 @@ pki.certificateFromAsn1 = function(obj, computeHash) {
1379
1381
  _fillMissingFields([attr]);
1380
1382
  cert.issuer.attributes.push(attr);
1381
1383
  };
1382
- cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer, imd);
1384
+ cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer);
1383
1385
  if(capture.certIssuerUniqueId) {
1384
1386
  cert.issuer.uniqueId = capture.certIssuerUniqueId;
1385
1387
  }
@@ -1387,6 +1389,8 @@ pki.certificateFromAsn1 = function(obj, computeHash) {
1387
1389
 
1388
1390
  // handle subject, build subject message digest
1389
1391
  var smd = forge.md.sha1.create();
1392
+ var sbytes = asn1.toDer(capture.certSubject);
1393
+ smd.update(sbytes.getBytes());
1390
1394
  cert.subject.getField = function(sn) {
1391
1395
  return _getAttribute(cert.subject, sn);
1392
1396
  };
@@ -1394,7 +1398,7 @@ pki.certificateFromAsn1 = function(obj, computeHash) {
1394
1398
  _fillMissingFields([attr]);
1395
1399
  cert.subject.attributes.push(attr);
1396
1400
  };
1397
- cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject, smd);
1401
+ cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject);
1398
1402
  if(capture.certSubjectUniqueId) {
1399
1403
  cert.subject.uniqueId = capture.certSubjectUniqueId;
1400
1404
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-forge",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.",
5
5
  "homepage": "https://github.com/digitalbazaar/forge",
6
6
  "author": {