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

kbpgp

Package Overview
Dependencies
Maintainers
1
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kbpgp - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

11

CHANGELOG.md

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

## 0.1.20 (2014-04-21)
Bugfixes:
- Better versions of fulfills_flags that take into account whether there's
an available unlocked secret key to do it.
- Better handle a secret key export in which no primary key is exported, and
no signing subkey is available (since typically, only the primary can sign).
- Able to write out partial secret keys in P3SKB mode (via reversing the
GNU dummy extension).
## 0.1.19 (2014-04-21)

@@ -2,0 +13,0 @@

4

lib/basekeypair.js

@@ -88,2 +88,6 @@ // Generated by IcedCoffeeScript 1.7.1-b

BaseKeyPair.prototype.has_private = function() {
return this.priv != null;
};
BaseKeyPair.prototype.fulfills_flags = function(flags) {

@@ -90,0 +94,0 @@ return false;

2

lib/dsa.js

@@ -161,3 +161,3 @@ // Generated by IcedCoffeeScript 1.7.1-b

var good_for;
good_for = C.key_flags.cerify_keys | C.key_flags.sign_data;
good_for = C.key_flags.certify_keys | C.key_flags.sign_data;
return (flags & good_for) === flags;

@@ -164,0 +164,0 @@ };

@@ -301,9 +301,3 @@ // Generated by IcedCoffeeScript 1.7.1-b

var err;
if (!this.key(eng2.primary).has_private()) {
err = null;
} else if (this._merge_1_private(this.primary, eng2.primary)) {
err = null;
} else {
err = new Error("primary public key doesn't match private key");
}
err = !this.key(eng2.primary).has_secret_key_material() ? null : this._merge_1_private(this.primary, eng2.primary) ? null : new Error("primary public key doesn't match private key");
return err;

@@ -314,3 +308,3 @@ };

var ekid, err, k;
err = !this.key(k2).has_private() ? null : (ekid = this.ekid(k2)) == null ? new Error("Subkey " + i + " is malformed") : (k = this._index[ekid]) == null ? new Error("Subkey " + i + " wasn't found in public key") : this._merge_1_private(k, k2) ? null : new Error("subkey " + i + " can't be merged");
err = !this.key(k2).has_secret_key_material() ? null : (ekid = this.ekid(k2)) == null ? new Error("Subkey " + i + " is malformed") : (k = this._index[ekid]) == null ? new Error("Subkey " + i + " wasn't found in public key") : this._merge_1_private(k, k2) ? null : new Error("subkey " + i + " can't be merged");
return err;

@@ -320,3 +314,3 @@ };

Engine.prototype.unlock_keys = function(_arg, cb) {
var asp, esc, passphrase, subkey, tsenc, ___iced_passed_deferral, __iced_deferrals, __iced_k;
var asp, esc, i, passphrase, subkey, tsenc, ___iced_passed_deferral, __iced_deferrals, __iced_k;
__iced_k = __iced_k_noop;

@@ -348,3 +342,3 @@ ___iced_passed_deferral = iced.findDeferral(arguments);

_len = _ref4.length;
_i = 0;
i = 0;
_results = [];

@@ -358,3 +352,3 @@ _while = function(__iced_k) {

return iced.trampoline(function() {
++_i;
++i;
return _while(__iced_k);

@@ -367,6 +361,6 @@ });

};
if (!(_i < _len)) {
if (!(i < _len)) {
return _break();
} else {
subkey = _ref4[_i];
subkey = _ref4[i];
(function(__iced_k) {

@@ -605,8 +599,15 @@ __iced_deferrals = new iced.Deferrals(__iced_k, {

PgpEngine.prototype.find_best_key = function(flags) {
PgpEngine.prototype.find_best_key = function(flags, need_priv) {
var check, k, wrapper, _i, _len, _ref4;
if (need_priv == null) {
need_priv = false;
}
wrapper = null;
check = (function(_this) {
return function(k) {
return _this.key(k).fulfills_flags(flags) || ((k.flags & flags) === flags);
var km, ok1, ok2;
km = _this.key(k);
ok1 = km.fulfills_flags(flags) || ((k.flags & flags) === flags);
ok2 = !need_priv || km.has_private();
return ok1 && ok2;
};

@@ -709,3 +710,3 @@ })(this);

})(),
lineno: 322
lineno: 328
})));

@@ -771,3 +772,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 331
lineno: 337
})));

@@ -837,3 +838,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 359
lineno: 365
}));

@@ -888,3 +889,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 372
lineno: 378
}));

@@ -928,3 +929,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 380
lineno: 386
}));

@@ -957,3 +958,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 383
lineno: 389
}));

@@ -986,3 +987,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 392
lineno: 398
}));

@@ -1029,3 +1030,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 407
lineno: 413
}));

@@ -1088,3 +1089,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 425
lineno: 431
}));

@@ -1127,3 +1128,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 439
lineno: 445
}));

@@ -1187,3 +1188,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 457
lineno: 463
}));

@@ -1225,3 +1226,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 470
lineno: 476
}));

@@ -1316,3 +1317,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 510
lineno: 516
}));

@@ -1405,12 +1406,15 @@ __iced_deferrals._fulfill();

KeyManager.prototype.find_best_pgp_key = function(flags) {
return this.pgp.find_best_key(flags);
KeyManager.prototype.find_best_pgp_key = function(flags, need_priv) {
return this.pgp.find_best_key(flags, need_priv);
};
KeyManager.prototype.find_signing_pgp_key = function() {
return this.find_best_pgp_key(C.key_flags.sign_data);
return this.find_best_pgp_key(C.key_flags.sign_data, true);
};
KeyManager.prototype.find_crypt_pgp_key = function() {
return this.find_best_pgp_key(C.key_flags.encrypt_comm);
KeyManager.prototype.find_crypt_pgp_key = function(need_priv) {
if (need_priv == null) {
need_priv = false;
}
return this.find_best_pgp_key(C.key_flags.encrypt_comm, need_priv);
};

@@ -1487,3 +1491,3 @@

})(),
lineno: 602
lineno: 608
}));

@@ -1490,0 +1494,0 @@ __iced_deferrals._fulfill();

// Generated by IcedCoffeeScript 1.7.1-b
(function() {
var AES, C, DSA, ElGamal, ElGamalSE, KeyMaterial, Packet, Parser, RSA, S, S2K, SHA1, SHA256, Signature, bufeq_secure, bufferify, calc_checksum, decrypt, encode, encrypt, iced, katch, make_time_packet, native_rng, packetsigs, symmetric, triplesec, uint_to_buffer, unix_time, util, __iced_k, __iced_k_noop, _ref, _ref1, _ref2,
var AES, C, DSA, ElGamal, ElGamalSE, FUCK, KeyMaterial, Packet, Parser, RSA, S, S2K, SHA1, SHA256, SecretKeyMaterial, Signature, bufeq_secure, bufferify, calc_checksum, decrypt, encode, encrypt, iced, katch, make_time_packet, native_rng, packetsigs, symmetric, triplesec, uint_to_buffer, unix_time, util, __iced_k, __iced_k_noop, _ref, _ref1, _ref2, _ref3,
__hasProp = {}.hasOwnProperty,

@@ -42,3 +42,3 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

S2K = require('../s2k').S2K;
_ref3 = require('../s2k'), S2K = _ref3.S2K, SecretKeyMaterial = _ref3.SecretKeyMaterial;

@@ -51,2 +51,4 @@ symmetric = require('../../symmetric');

FUCK = 0;
KeyMaterial = (function(_super) {

@@ -59,2 +61,3 @@ __extends(KeyMaterial, _super);

this.flags || (this.flags = 0);
this.cnt = FUCK++;
KeyMaterial.__super__.constructor.call(this);

@@ -96,2 +99,6 @@ }

KeyMaterial.prototype._write_dummy = function(bufs) {
return bufs.push(new Buffer([C.s2k_convention.sha1, C.symmetric_key_algorithms.AES256, C.s2k.gnu, 0x2]), new Buffer("GNU", "utf8"), new Buffer([0x1]));
};
KeyMaterial.prototype.add_flags = function(v) {

@@ -102,8 +109,10 @@ return this.flags |= v;

KeyMaterial.prototype.private_body = function(opts) {
var bufs, pp, priv, ret;
var bufs, p, pp, priv, ret;
bufs = [];
this._write_public(bufs);
priv = this.key.priv.serialize();
priv = (p = this.key.priv) != null ? p.serialize() : null;
pp = opts.passphrase || this.passphrase;
if (pp != null) {
if (priv == null) {
this._write_dummy(bufs);
} else if (pp != null) {
this._write_private_enc(bufs, priv, pp);

@@ -187,5 +196,5 @@ } else {

return (function(__iced_k) {
var _i, _len, _ref3, _results, _while;
_ref3 = userids;
_len = _ref3.length;
var _i, _len, _ref4, _results, _while;
_ref4 = userids;
_len = _ref4.length;
_i = 0;

@@ -211,3 +220,3 @@ _results = [];

} else {
userid = _ref3[_i];
userid = _ref4[_i];
if (err == null) {

@@ -234,3 +243,3 @@ sig = null;

})(),
lineno: 171
lineno: 192
}));

@@ -293,3 +302,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 210
lineno: 231
}));

@@ -324,3 +333,3 @@ __iced_deferrals._fulfill();

return (function(__iced_k) {
var _ref3, _ref4;
var _ref4, _ref5;
if (_this.key.can_sign() && subkey.key.can_sign()) {

@@ -342,3 +351,3 @@ (function(__iced_k) {

})(),
lineno: 223
lineno: 244
}));

@@ -348,3 +357,3 @@ __iced_deferrals._fulfill();

} else {
return __iced_k(!((_ref3 = subkey.get_subkey_binding()) != null ? (_ref4 = _ref3.sig) != null ? _ref4.get_framed_output() : void 0 : void 0) ? err = new Error("Cannot sign key --- don't have private key and can't replay") : void 0);
return __iced_k(!((_ref4 = subkey.get_subkey_binding()) != null ? (_ref5 = _ref4.sig) != null ? _ref5.get_framed_output() : void 0 : void 0) ? err = new Error("Cannot sign key --- don't have private key and can't replay") : void 0);
}

@@ -382,3 +391,3 @@ });

})(),
lineno: 232
lineno: 253
}));

@@ -408,3 +417,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 234
lineno: 255
}));

@@ -458,3 +467,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 258
lineno: 279
}));

@@ -499,3 +508,3 @@ __iced_deferrals._fulfill();

})(),
lineno: 278
lineno: 299
}));

@@ -528,4 +537,4 @@ __iced_deferrals._fulfill();

KeyMaterial.prototype.is_primary = function() {
var _ref3;
return !((_ref3 = this.opts) != null ? _ref3.subkey : void 0);
var _ref4;
return !((_ref4 = this.opts) != null ? _ref4.subkey : void 0);
};

@@ -542,9 +551,21 @@

KeyMaterial.prototype.is_locked = function() {
return (!this.key.can_sign()) && ((this.skm != null) && (this.skm.convention !== C.s2k_convention.none));
return (!this.key.has_private()) && (this.skm != null) && this.skm.is_locked();
};
KeyMaterial.prototype.has_private = function() {
return this.key.can_sign() || (this.skm != null);
return this.has_unlocked_private() || this.has_locked_private();
};
KeyMaterial.prototype.has_locked_private = function() {
return this.skm && this.skm.has_private();
};
KeyMaterial.prototype.has_unlocked_private = function() {
return this.key.has_private();
};
KeyMaterial.prototype.has_secret_key_material = function() {
return this.skm != null;
};
KeyMaterial.prototype.is_signed_subkey_of = function(primary) {

@@ -563,4 +584,4 @@ return (!this.primary_flag) && this.get_psc().is_signed_subkey_of(primary);

KeyMaterial.prototype.get_subkey_binding_signature_output = function() {
var _ref3, _ref4;
return (_ref3 = this.get_subkey_binding()) != null ? (_ref4 = _ref3.sig) != null ? _ref4.get_framed_output() : void 0 : void 0;
var _ref4, _ref5;
return (_ref4 = this.get_subkey_binding()) != null ? (_ref5 = _ref4.sig) != null ? _ref5.get_framed_output() : void 0 : void 0;
};

@@ -577,2 +598,6 @@

err = null;
if (this.skm == null) {
err = new Error("Cannot unlock secret key -- no material!");
return cb(err);
}
pt = this.skm.s2k_convention === C.s2k_convention.none ? this.skm.payload : this.skm.s2k.type === C.s2k.gnu_dummy ? null : (key = this.skm.s2k.produce_key(passphrase, this.skm.cipher.key_size), decrypt({

@@ -616,2 +641,6 @@ ciphertext: this.skm.payload,

KeyMaterial.prototype.add_flags = function(v) {
return this.flags |= v;
};
KeyMaterial.prototype.fulfills_flags = function(flags) {

@@ -621,6 +650,2 @@ return ((this.get_all_key_flags() & flags) === flags) || this.key.fulfills_flags(flags);

KeyMaterial.prototype.add_flags = function(v) {
return this.flags |= v;
};
KeyMaterial.prototype.get_signed_userids = function() {

@@ -665,3 +690,3 @@ return this.get_psc().get_signed_userids();

Parser.prototype.parse_public_key_mpis = function() {
var A, err, key, klass, len, _ref3;
var A, err, key, klass, len, _ref4;
this.algorithm = this.slice.read_uint8();

@@ -685,3 +710,3 @@ A = C.public_key_algorithms;

}).call(this);
_ref3 = klass.parse(this.slice.peek_rest_to_buffer()), err = _ref3[0], key = _ref3[1], len = _ref3[2];
_ref4 = klass.parse(this.slice.peek_rest_to_buffer()), err = _ref4[0], key = _ref4[1], len = _ref4[2];
if (err != null) {

@@ -717,4 +742,4 @@ throw err;

Parser.prototype.parse_private_key = function(opts) {
var encrypted_private_key, iv_len, key, skm, sym_enc_alg, _ref3;
skm = {};
var encrypted_private_key, iv_len, key, skm, sym_enc_alg, _ref4;
skm = new SecretKeyMaterial();
key = this._parse_public_key();

@@ -726,3 +751,3 @@ encrypted_private_key = true;

} else {
if ((_ref3 = skm.s2k_convention) === C.s2k_convention.sha1 || _ref3 === C.s2k_convention.checksum) {
if ((_ref4 = skm.s2k_convention) === C.s2k_convention.sha1 || _ref4 === C.s2k_convention.checksum) {
sym_enc_alg = this.slice.read_uint8();

@@ -729,0 +754,0 @@ skm.s2k = (new S2K).read(this.slice);

// Generated by IcedCoffeeScript 1.7.1-b
(function() {
var C, S2K, SHA256, alloc, triplesec, _ref;
var C, S2K, SHA256, SecretKeyMaterial, alloc, triplesec, _ref;

@@ -79,2 +79,6 @@ triplesec = require('triplesec');

S2K.prototype.is_dummy = function() {
return this.type === C.s2k.gnu_dummy;
};
S2K.prototype.produce_key = function(passphrase, numBytes) {

@@ -120,4 +124,31 @@ var i, isp, key, n, ret, seed;

SecretKeyMaterial = (function() {
function SecretKeyMaterial() {
this.s2k_convention = null;
this.s2k = null;
this.iv = null;
this.cipher = null;
this.payload = null;
}
SecretKeyMaterial.prototype.is_dummy = function() {
return (this.s2k != null) && this.s2k.is_dummy();
};
SecretKeyMaterial.prototype.has_private = function() {
return !this.is_dummy();
};
SecretKeyMaterial.prototype.is_locked = function() {
return (this.s2k_convention !== C.s2k_convention.none) && !(this.is_dummy());
};
return SecretKeyMaterial;
})();
exports.S2K = S2K;
exports.SecretKeyMaterial = SecretKeyMaterial;
}).call(this);

@@ -10,3 +10,3 @@ {

"author": "Maxwell Krohn",
"version": "0.1.9",
"version": "0.1.10",
"license": "BSD-3-Clause",

@@ -13,0 +13,0 @@ "main": "./lib/main.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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