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

@lapo/extractcms

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lapo/extractcms - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

README.md.orig

30

cms.js
// CMS (PKCS#7) SignedData extraction
// Copyright (c) 2018 Lapo Luchini <lapo@lapo.it>
// Copyright (c) 2018-2020 Lapo Luchini <lapo@lapo.it>

@@ -48,6 +48,6 @@ // Permission to use, copy, modify, and/or distribute this software for any

const header = '-----BEGIN PKCS7-----';
let idx = data.indexOf(header);
let idx = b64.indexOf(header);
if (idx >= 0) {
const idx1 = idx + header.length;
const idx2 = data.indexOf('-----END PKCS7-----', idx1);
const idx2 = b64.indexOf('-----END PKCS7-----', idx1);
b64 = b64.slice(idx1, idx2);

@@ -65,5 +65,8 @@ }

function extractCMS(data) {
let contentInfo = parseCMS(data); // https://tools.ietf.org/html/rfc5652#section-3
const signedData = parseTypedData(contentInfo, '1.2.840.113549.1.7.2', 'ContentInfo').sub[0]; // https://tools.ietf.org/html/rfc5652#section-5.1
function CMS(data) {
this.contentInfo = parseCMS(data);
}
CMS.prototype.extract = function () {
const signedData = parseTypedData(this.contentInfo, '1.2.840.113549.1.7.2', 'ContentInfo').sub[0]; // https://tools.ietf.org/html/rfc5652#section-5.1
if (signedData.typeName() != 'SEQUENCE')

@@ -75,7 +78,14 @@ throw new Error('SignedData is not a DER SEQUENCE.');

return parseOctetString(content);
}
};
module.exports = {
parse: parseCMS,
extract: extractCMS,
// utility methods to keep retro-compatibility
CMS.parse = function (data) {
return new CMS(data).contentInfo;
};
CMS.extract = function (data) {
return new CMS(data).extract();
};
module.exports = CMS;
{
"name": "@lapo/extractcms",
"version": "1.0.3",
"description": "Extract CMS/PKCS#7 signed envelopes (does not verify signature).",
"version": "1.0.4",
"description": "Extract CMS/PKCS#7 (P7M) signed envelopes (does not verify signature).",
"main": "cms.js",

@@ -10,3 +10,3 @@ "repository": {

},
"keywords": [ "cms", "pkcs7", "der", "pem" ],
"keywords": [ "cms", "pkcs7", "p7m", "der", "pem" ],
"author": "Lapo Luchini <lapo@lapo.it>",

@@ -17,3 +17,3 @@ "license": "ISC",

"dependencies": {
"@lapo/asn1js": "^1.0.0"
"@lapo/asn1js": "^1.2.1"
},

@@ -20,0 +20,0 @@ "files": [ "cms.js" ],

@@ -23,3 +23,3 @@ extractCMS

CMS (PKCS#7) SignedData extraction Copyright (c) 2018 Lapo Luchini <lapo@lapo.it>
CMS (PKCS#7) SignedData extraction Copyright (c) 2018-2020 Lapo Luchini <lapo@lapo.it>

@@ -26,0 +26,0 @@ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

Sorry, the diff of this file is not supported yet

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