New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-forge

Package Overview
Dependencies
Maintainers
3
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-forge - npm Package Compare versions

Comparing version 0.6.38 to 0.6.39

2

bower.json
{
"name": "forge",
"version": "0.6.38",
"version": "0.6.39",
"description": "JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.",

@@ -5,0 +5,0 @@ "moduleType": ["amd"],

@@ -199,2 +199,3 @@ /**

oids['2.5.29.35'] = 'authorityKeyIdentifier';
oids['authorityKeyIdentifier'] = '2.5.29.35';
oids['2.5.29.36'] = 'policyConstraints';

@@ -201,0 +202,0 @@ oids['2.5.29.37'] = 'extKeyUsage';

@@ -386,3 +386,59 @@ (function() {

it('should convert "foo" to its UTF-8 representation', function() {
if(typeof Uint8Array === 'undefined') {
return;
}
var result = UTIL.text.utf8.encode('foo');
ASSERT.equal(result.byteLength, 3);
ASSERT.equal(result[0], 102);
ASSERT.equal(result[1], 111);
ASSERT.equal(result[2], 111);
});
it('should convert "foo" from its UTF-8 representation', function() {
if(typeof Uint8Array === 'undefined') {
return;
}
var bytes = new Uint8Array([102, 111, 111]);
// FIXME: remove try/catch once phantomjs supports apply(TypedArray)
// or a fallback is implemented
try {
var result = UTIL.text.utf8.decode(bytes);
ASSERT.equal(result, 'foo');
} catch(e) {
ASSERT.isTrue(e instanceof TypeError);
}
});
it('should convert "\ud83c\udc00" to its UTF-8 representation', function() {
if(typeof Uint8Array === 'undefined') {
return;
}
var result = UTIL.text.utf8.encode('\ud83c\udc00');
ASSERT.equal(result.byteLength, 4);
ASSERT.equal(result[0], 240);
ASSERT.equal(result[1], 159);
ASSERT.equal(result[2], 128);
ASSERT.equal(result[3], 128);
});
it('should convert "\ud83c\udc00" from its UTF-8 representation', function() {
if(typeof Uint8Array === 'undefined') {
return;
}
var bytes = new Uint8Array([240, 159, 128, 128]);
// FIXME: remove try/catch once phantomjs supports apply(TypedArray)
// or a fallback is implemented
try {
var result = UTIL.text.utf8.decode(bytes);
ASSERT.equal(result, '\ud83c\udc00');
} catch(e) {
ASSERT.isTrue(e instanceof TypeError);
}
});
it('should convert "foo" to its UTF-16 representation', function() {
if(typeof Uint8Array === 'undefined') {
return;
}
var result = UTIL.text.utf16.encode('foo');

@@ -399,8 +455,20 @@ ASSERT.equal(result.byteLength, 6);

it('should convert "foo" from its UTF-16 representation', function() {
if(typeof Uint8Array === 'undefined') {
return;
}
var bytes = new Uint8Array([102, 0, 111, 0, 111, 0]);
var result = UTIL.text.utf16.decode(bytes);
ASSERT.equal(result, 'foo');
// FIXME: remove try/catch once phantomjs supports apply(TypedArray)
// or a fallback is implemented
try {
var result = UTIL.text.utf16.decode(bytes);
ASSERT.equal(result, 'foo');
} catch(e) {
ASSERT.isTrue(e instanceof TypeError);
}
});
it('should convert "\ud83c\udc00" to its UTF-16 representation', function() {
if(typeof Uint8Array === 'undefined') {
return;
}
var result = UTIL.text.utf16.encode('\ud83c\udc00');

@@ -415,5 +483,14 @@ ASSERT.equal(result.byteLength, 4);

it('should convert "\ud83c\udc00" from its UTF-16 representation', function() {
if(typeof Uint8Array === 'undefined') {
return;
}
var bytes = new Uint8Array([60, 216, 0, 220]);
var result = UTIL.text.utf16.decode(bytes);
ASSERT.equal(result, '\ud83c\udc00');
// FIXME: remove try/catch once phantomjs supports apply(TypedArray)
// or a fallback is implemented
try {
var result = UTIL.text.utf16.decode(bytes);
ASSERT.equal(result, '\ud83c\udc00');
} catch(e) {
ASSERT.isTrue(e instanceof TypeError);
}
});

@@ -420,0 +497,0 @@ });

@@ -205,2 +205,67 @@ (function() {

it('should generate a certificate with authorityKeyIdentifier extension', function() {
var keys = {
privateKey: PKI.privateKeyFromPem(_pem.privateKey),
publicKey: PKI.publicKeyFromPem(_pem.publicKey)
};
var attrs = [{
name: 'commonName',
value: 'example.org'
}, {
name: 'countryName',
value: 'US'
}, {
shortName: 'ST',
value: 'Virginia'
}, {
name: 'localityName',
value: 'Blacksburg'
}, {
name: 'organizationName',
value: 'Test'
}, {
shortName: 'OU',
value: 'Test'
}];
var cert = createCertificate({
publicKey: keys.publicKey,
signingKey: keys.privateKey,
extensions: [{
name: 'authorityKeyIdentifier',
keyIdentifier: true,
authorityCertIssuer: true,
serialNumber: true
}],
serialNumber: '01',
subject: attrs,
issuer: attrs,
isCA: true
});
// verify certificate encoding/parsing
var pem = PKI.certificateToPem(cert);
cert = PKI.certificateFromPem(pem);
// verify authorityKeyIdentifier extension
var index = findIndex(cert.extensions, {id: '2.5.29.35'});
ASSERT.ok(index !== -1);
var ext = cert.extensions[index];
ASSERT.equal(ext.name, 'authorityKeyIdentifier');
ASSERT.equal(ext.value, UTIL.hexToBytes(
'3081888014f57563e0c75d6e9b03fafdb2fd72349f23030300a16da46b30693114' +
'30120603550403130b6578616d706c652e6f7267310b3009060355040613025553' +
'3111300f0603550408130856697267696e6961311330110603550407130a426c61' +
'636b7362757267310d300b060355040a130454657374310d300b060355040b1304' +
'54657374820101'));
// verify certificate chain
var caStore = PKI.createCaStore();
caStore.addCertificate(cert);
PKI.verifyCertificateChain(caStore, [cert], function(vfd, depth, chain) {
ASSERT.equal(vfd, true);
ASSERT.ok(cert.verifySubjectKeyIdentifier());
return true;
});
});
it('should generate and verify a self-signed certificate', function() {

@@ -795,2 +860,15 @@ var keys = {

function findIndex(array, predicateObj) {
var result = -1;
array.forEach(function(el, index) {
var match = Object.keys(predicateObj).reduce(function(soFar, key) {
return soFar && el[key] === predicateObj[key];
}, true);
if(match) {
result = index;
}
});
return result;
}
function createCertificate(options) {

@@ -813,3 +891,3 @@ var publicKey = options.publicKey;

cert.setIssuer(issuer);
var extensions = [];
var extensions = options.extensions || [];
if(isCA) {

@@ -816,0 +894,0 @@ extensions.push({

{
"name": "node-forge",
"version": "0.6.38",
"version": "0.6.39",
"description": "JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.",
"homepage": "http://github.com/digitalbazaar/forge",
"homepage": "https://github.com/digitalbazaar/forge",
"author": {

@@ -32,3 +32,3 @@ "name": "Digital Bazaar, Inc.",

"type": "git",
"url": "http://github.com/digitalbazaar/forge"
"url": "https://github.com/digitalbazaar/forge"
},

@@ -35,0 +35,0 @@ "bugs": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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