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

openpgp

Package Overview
Dependencies
Maintainers
1
Versions
181
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openpgp - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

dist/openpgp.worker.min.js

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

/*! OpenPGPjs.org this is LGPL licensed code, see LICENSE/our website for more information.- v1.1.0 - 2015-06-09 */!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){window.openpgp.crypto.random.randomBuffer.size<g&&postMessage({event:"request-seed"}),postMessage(a)}function e(a){var b=window.openpgp.packet.List.fromStructuredClone(a);return new window.openpgp.key.Key(b)}function f(a){var b=window.openpgp.packet.List.fromStructuredClone(a);return new window.openpgp.message.Message(b)}window={},Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),importScripts("openpgp.min.js");var g=4e4,h=6e4;window.openpgp.crypto.random.randomBuffer.init(h),self.onmessage=function(a){var b=null,c=null,g=a.data,h=!1;switch(g.event){case"configure":for(var i in g.config)window.openpgp.config[i]=g.config[i];break;case"seed-random":g.buf instanceof Uint8Array||(g.buf=new Uint8Array(g.buf)),window.openpgp.crypto.random.randomBuffer.set(g.buf);break;case"encrypt-message":g.keys.length||(g.keys=[g.keys]),g.keys=g.keys.map(e),window.openpgp.encryptMessage(g.keys,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"sign-and-encrypt-message":g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e),g.privateKey=e(g.privateKey),window.openpgp.signAndEncryptMessage(g.publicKeys,g.privateKey,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-message":g.privateKey=e(g.privateKey),g.message=f(g.message.packets),window.openpgp.decryptMessage(g.privateKey,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-and-verify-message":g.privateKey=e(g.privateKey),g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e),g.message=f(g.message.packets),window.openpgp.decryptAndVerifyMessage(g.privateKey,g.publicKeys,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"sign-clear-message":g.privateKeys=g.privateKeys.map(e),window.openpgp.signClearMessage(g.privateKeys,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"verify-clear-signed-message":g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e);var j=window.openpgp.packet.List.fromStructuredClone(g.message.packets);g.message=new window.openpgp.cleartext.CleartextMessage(g.message.text,j),window.openpgp.verifyClearSignedMessage(g.publicKeys,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"generate-key-pair":window.openpgp.generateKeyPair(g.options).then(function(a){a.key=a.key.toPacketlist(),d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-key":try{g.privateKey=e(g.privateKey),h=g.privateKey.decrypt(g.password),h?b=g.privateKey.toPacketlist():c="Wrong password"}catch(k){c=k.message}d({event:"method-return",data:b,err:c});break;case"decrypt-key-packet":try{g.privateKey=e(g.privateKey),g.keyIds=g.keyIds.map(window.openpgp.Keyid.fromClone),h=g.privateKey.decryptKeyPacket(g.keyIds,g.password),h?b=g.privateKey.toPacketlist():c="Wrong password"}catch(k){c=k.message}d({event:"method-return",data:b,err:c});break;default:throw new Error("Unknown Worker Event.")}}},{}]},{},[1]);
/*! OpenPGPjs.org this is LGPL licensed code, see LICENSE/our website for more information.- v1.2.0 - 2015-06-12 */!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){window.openpgp.crypto.random.randomBuffer.size<g&&postMessage({event:"request-seed"}),postMessage(a)}function e(a){var b=window.openpgp.packet.List.fromStructuredClone(a);return new window.openpgp.key.Key(b)}function f(a){var b=window.openpgp.packet.List.fromStructuredClone(a);return new window.openpgp.message.Message(b)}window={},Function.prototype.bind||(Function.prototype.bind=function(a){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var b=Array.prototype.slice.call(arguments,1),c=this,d=function(){},e=function(){return c.apply(this instanceof d&&a?this:a,b.concat(Array.prototype.slice.call(arguments)))};return d.prototype=this.prototype,e.prototype=new d,e}),importScripts("openpgp.min.js");var g=4e4,h=6e4;window.openpgp.crypto.random.randomBuffer.init(h),self.onmessage=function(a){var b=null,c=null,g=a.data,h=!1;switch(g.event){case"configure":for(var i in g.config)window.openpgp.config[i]=g.config[i];break;case"seed-random":g.buf instanceof Uint8Array||(g.buf=new Uint8Array(g.buf)),window.openpgp.crypto.random.randomBuffer.set(g.buf);break;case"encrypt-message":g.keys.length||(g.keys=[g.keys]),g.keys=g.keys.map(e),window.openpgp.encryptMessage(g.keys,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"sign-and-encrypt-message":g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e),g.privateKey=e(g.privateKey),window.openpgp.signAndEncryptMessage(g.publicKeys,g.privateKey,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-message":g.privateKey=e(g.privateKey),g.message=f(g.message.packets),window.openpgp.decryptMessage(g.privateKey,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-and-verify-message":g.privateKey=e(g.privateKey),g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e),g.message=f(g.message.packets),window.openpgp.decryptAndVerifyMessage(g.privateKey,g.publicKeys,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"sign-clear-message":g.privateKeys=g.privateKeys.map(e),window.openpgp.signClearMessage(g.privateKeys,g.text).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"verify-clear-signed-message":g.publicKeys.length||(g.publicKeys=[g.publicKeys]),g.publicKeys=g.publicKeys.map(e);var j=window.openpgp.packet.List.fromStructuredClone(g.message.packets);g.message=new window.openpgp.cleartext.CleartextMessage(g.message.text,j),window.openpgp.verifyClearSignedMessage(g.publicKeys,g.message).then(function(a){d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"generate-key-pair":window.openpgp.generateKeyPair(g.options).then(function(a){a.key=a.key.toPacketlist(),d({event:"method-return",data:a})})["catch"](function(a){d({event:"method-return",err:a.message})});break;case"decrypt-key":try{g.privateKey=e(g.privateKey),h=g.privateKey.decrypt(g.password),h?b=g.privateKey.toPacketlist():c="Wrong password"}catch(k){c=k.message}d({event:"method-return",data:b,err:c});break;case"decrypt-key-packet":try{g.privateKey=e(g.privateKey),g.keyIds=g.keyIds.map(window.openpgp.Keyid.fromClone),h=g.privateKey.decryptKeyPacket(g.keyIds,g.password),h?b=g.privateKey.toPacketlist():c="Wrong password"}catch(k){c=k.message}d({event:"method-return",data:b,err:c});break;default:throw new Error("Unknown Worker Event.")}}},{}]},{},[1]);
{
"name": "openpgp",
"description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
"version": "1.1.0",
"version": "1.2.0",
"homepage": "http://openpgpjs.org/",

@@ -6,0 +6,0 @@ "engines": {

@@ -181,3 +181,3 @@ // Modified by Recurity Labs GmbH

var i, n = '';
var text = '';
var text = [];

@@ -204,7 +204,7 @@ // initialisation vector

/* RFC4880: Tag 18 and Resync:
* [...] Unlike the Symmetrically Encrypted Data Packet, no
* special CFB resynchronization is done after encrypting this prefix
* data. See "OpenPGP CFB Mode" below for more details.
* [...] Unlike the Symmetrically Encrypted Data Packet, no
* special CFB resynchronization is done after encrypting this prefix
* data. See "OpenPGP CFB Mode" below for more details.
*/
*/

@@ -220,3 +220,3 @@ if (resync) {

iblock[i] = ciphertext.charCodeAt(n + i);
text += String.fromCharCode(ablock[i] ^ iblock[i]);
text.push(String.fromCharCode(ablock[i] ^ iblock[i]));
}

@@ -232,15 +232,14 @@ }

iblock[i] = ciphertext.charCodeAt(n + i);
text += String.fromCharCode(ablock[i] ^ iblock[i]);
text.push(String.fromCharCode(ablock[i] ^ iblock[i]));
}
}
}
n = resync ? 0 : 2;
text = text.substring(n, ciphertext.length - block_size - 2 + n);
if (!resync)
{
text.splice(0, 2);
}
text.splice(ciphertext.length - block_size - 2);
return text;
},
normalEncrypt: function(cipherfn, key, plaintext, iv) {

@@ -247,0 +246,0 @@ cipherfn = new cipher[cipherfn](key);

@@ -353,52 +353,52 @@ // GPG4Browsers - An OpenPGP implementation in javascript

function armor(messagetype, body, partindex, parttotal) {
var result = "";
var result = [];
switch (messagetype) {
case enums.armor.multipart_section:
result += "-----BEGIN PGP MESSAGE, PART " + partindex + "/" + parttotal + "-----\r\n";
result += addheader();
result += base64.encode(body);
result += "\r\n=" + getCheckSum(body) + "\r\n";
result += "-----END PGP MESSAGE, PART " + partindex + "/" + parttotal + "-----\r\n";
result.push("-----BEGIN PGP MESSAGE, PART " + partindex + "/" + parttotal + "-----\r\n");
result.push(addheader());
result.push(base64.encode(body));
result.push("\r\n=" + getCheckSum(body) + "\r\n");
result.push("-----END PGP MESSAGE, PART " + partindex + "/" + parttotal + "-----\r\n");
break;
case enums.armor.multipart_last:
result += "-----BEGIN PGP MESSAGE, PART " + partindex + "-----\r\n";
result += addheader();
result += base64.encode(body);
result += "\r\n=" + getCheckSum(body) + "\r\n";
result += "-----END PGP MESSAGE, PART " + partindex + "-----\r\n";
result.push("-----BEGIN PGP MESSAGE, PART " + partindex + "-----\r\n");
result.push(addheader());
result.push(base64.encode(body));
result.push("\r\n=" + getCheckSum(body) + "\r\n");
result.push("-----END PGP MESSAGE, PART " + partindex + "-----\r\n");
break;
case enums.armor.signed:
result += "\r\n-----BEGIN PGP SIGNED MESSAGE-----\r\n";
result += "Hash: " + body.hash + "\r\n\r\n";
result += body.text.replace(/\n-/g, "\n- -");
result += "\r\n-----BEGIN PGP SIGNATURE-----\r\n";
result += addheader();
result += base64.encode(body.data);
result += "\r\n=" + getCheckSum(body.data) + "\r\n";
result += "-----END PGP SIGNATURE-----\r\n";
result.push("\r\n-----BEGIN PGP SIGNED MESSAGE-----\r\n");
result.push("Hash: " + body.hash + "\r\n\r\n");
result.push(body.text.replace(/\n-/g, "\n- -"));
result.push("\r\n-----BEGIN PGP SIGNATURE-----\r\n");
result.push(addheader());
result.push(base64.encode(body.data));
result.push("\r\n=" + getCheckSum(body.data) + "\r\n");
result.push("-----END PGP SIGNATURE-----\r\n");
break;
case enums.armor.message:
result += "-----BEGIN PGP MESSAGE-----\r\n";
result += addheader();
result += base64.encode(body);
result += "\r\n=" + getCheckSum(body) + "\r\n";
result += "-----END PGP MESSAGE-----\r\n";
result.push("-----BEGIN PGP MESSAGE-----\r\n");
result.push(addheader());
result.push(base64.encode(body));
result.push("\r\n=" + getCheckSum(body) + "\r\n");
result.push("-----END PGP MESSAGE-----\r\n");
break;
case enums.armor.public_key:
result += "-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n";
result += addheader();
result += base64.encode(body);
result += "\r\n=" + getCheckSum(body) + "\r\n";
result += "-----END PGP PUBLIC KEY BLOCK-----\r\n\r\n";
result.push("-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n");
result.push(addheader());
result.push(base64.encode(body));
result.push("\r\n=" + getCheckSum(body) + "\r\n");
result.push("-----END PGP PUBLIC KEY BLOCK-----\r\n\r\n");
break;
case enums.armor.private_key:
result += "-----BEGIN PGP PRIVATE KEY BLOCK-----\r\n";
result += addheader();
result += base64.encode(body);
result += "\r\n=" + getCheckSum(body) + "\r\n";
result += "-----END PGP PRIVATE KEY BLOCK-----\r\n";
result.push("-----BEGIN PGP PRIVATE KEY BLOCK-----\r\n");
result.push(addheader());
result.push(base64.encode(body));
result.push("\r\n=" + getCheckSum(body) + "\r\n");
result.push("-----END PGP PRIVATE KEY BLOCK-----\r\n");
break;
}
return result;
return result.join('');
}

@@ -405,0 +405,0 @@

@@ -26,7 +26,8 @@ /* OpenPGP radix-64/base64 string encoding/decoding

*/
function s2r(t) {
function s2r(t, o) {
// TODO check btoa alternative
var a, c, n;
var r = '',
l = 0,
s = 0;
var r = o ? o : [],
l = 0,
s = 0;
var tl = t.length;

@@ -37,17 +38,17 @@

if (s === 0) {
r += b64s.charAt((c >> 2) & 63);
r.push(b64s.charAt((c >> 2) & 63));
a = (c & 3) << 4;
} else if (s == 1) {
r += b64s.charAt((a | (c >> 4) & 15));
r.push(b64s.charAt((a | (c >> 4) & 15)));
a = (c & 15) << 2;
} else if (s == 2) {
r += b64s.charAt(a | ((c >> 6) & 3));
r.push(b64s.charAt(a | ((c >> 6) & 3)));
l += 1;
if ((l % 60) === 0)
r += "\n";
r += b64s.charAt(c & 63);
r.push("\n");
r.push(b64s.charAt(c & 63));
}
l += 1;
if ((l % 60) === 0)
r += "\n";
r.push("\n");

@@ -59,7 +60,7 @@ s += 1;

if (s > 0) {
r += b64s.charAt(a);
r.push(b64s.charAt(a));
l += 1;
if ((l % 60) === 0)
r += "\n";
r += '=';
r.push("\n");
r.push('=');
l += 1;

@@ -69,7 +70,10 @@ }

if ((l % 60) === 0)
r += "\n";
r += '=';
r.push("\n");
r.push('=');
}
return r;
if (o)
{
return;
}
return r.join('');
}

@@ -84,6 +88,7 @@

function r2s(t) {
// TODO check atob alternative
var c, n;
var r = '',
s = 0,
a = 0;
var r = [],
s = 0,
a = 0;
var tl = t.length;

@@ -95,3 +100,3 @@

if (s)
r += String.fromCharCode(a | (c >> (6 - s)) & 255);
r.push(String.fromCharCode(a | (c >> (6 - s)) & 255));
s = (s + 2) & 7;

@@ -101,3 +106,3 @@ a = (c << s) & 255;

}
return r;
return r.join('');
}

@@ -104,0 +109,0 @@

@@ -96,4 +96,8 @@ // GPG4Browsers - An OpenPGP implementation in javascript

this.encrypted = crypto.cfb.encrypt(prefixrandom,
sessionKeyAlgorithm, tohash, key, false).substring(0,
prefix.length + tohash.length);
sessionKeyAlgorithm, tohash, key, false);
if (prefix.length + tohash.length != this.encrypted.length)
{
this.encrypted = this.encrypted.substring(0, prefix.length + tohash.length);
}
};

@@ -114,15 +118,18 @@

var mdc = decrypted.slice(decrypted.length - 20, decrypted.length).join('');
decrypted.splice(decrypted.length - 20);
// there must be a modification detection code packet as the
// last packet and everything gets hashed except the hash itself
this.hash = crypto.hash.sha1(
crypto.cfb.mdc(sessionKeyAlgorithm, key, this.encrypted) + decrypted.substring(0, decrypted.length - 20));
crypto.cfb.mdc(sessionKeyAlgorithm, key, this.encrypted) + decrypted.join(''));
var mdc = decrypted.substr(decrypted.length - 20, 20);
if (this.hash != mdc) {
throw new Error('Modification detected.');
} else
this.packets.read(decrypted.substr(0, decrypted.length - 22));
} else {
decrypted.splice(decrypted.length - 2);
this.packets.read(decrypted.join(''));
}
};

@@ -122,2 +122,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

this.sessionKeyEncryptionAlgorithm, key, this.encrypted, true);
decrypted = decrypted.join('');

@@ -124,0 +125,0 @@ this.sessionKeyAlgorithm = enums.read(enums.symmetric,

@@ -68,3 +68,3 @@ // GPG4Browsers - An OpenPGP implementation in javascript

this.packets.read(decrypted);
this.packets.read(decrypted.join(''))
};

@@ -71,0 +71,0 @@

@@ -205,7 +205,7 @@ // GPG4Browsers - An OpenPGP implementation in javascript

Uint8Array2str: function (bin) {
var result = '';
var result = [];
for (var i = 0; i < bin.length; i++) {
result += String.fromCharCode(bin[i]);
result[i] = String.fromCharCode(bin[i]);
}
return result;
return result.join('');
},

@@ -212,0 +212,0 @@

@@ -264,3 +264,3 @@ 'use strict';

var symmencData = openpgp.crypto.cfb.encrypt(openpgp.crypto.getPrefixRandom(algo), algo, plaintext, symmKey, resync);
var text = openpgp.crypto.cfb.decrypt(algo, symmKey, symmencData, resync);
var text = openpgp.crypto.cfb.decrypt(algo, symmKey, symmencData, resync).join('');
expect(text).to.equal(plaintext);

@@ -267,0 +267,0 @@ });

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

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