Comparing version 0.1.8 to 0.1.9
@@ -0,1 +1,9 @@ | ||
## 0.1.19 (2014-04-21) | ||
Bugfixes: | ||
- Better support for private key merging --- don't require an exact-key-for-key | ||
match, but rather, allow only some of the secret subkeys (and not the primary) to | ||
be merged. This addresses [Keybase Issue #216](https://github.com/keybase/keybase-issues/issues/216) | ||
## 0.1.8 (2014-04-14) | ||
@@ -2,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by IcedCoffeeScript 1.7.1-a | ||
// Generated by IcedCoffeeScript 1.7.1-b | ||
(function() { | ||
@@ -80,3 +80,4 @@ var config, k, openpgp, v; | ||
salt_iter: 3, | ||
gnu: 101 | ||
gnu: 101, | ||
gnu_dummy: 1001 | ||
}, | ||
@@ -83,0 +84,0 @@ s2k_convention: { |
@@ -48,5 +48,18 @@ // Generated by IcedCoffeeScript 1.7.1-b | ||
} | ||
this._index_keys(); | ||
true; | ||
} | ||
Engine.prototype._index_keys = function() { | ||
var k, _i, _len, _ref4, _results; | ||
this._index = {}; | ||
_ref4 = this._all_keys(); | ||
_results = []; | ||
for (_i = 0, _len = _ref4.length; _i < _len; _i++) { | ||
k = _ref4[_i]; | ||
_results.push(this._index[this.ekid(k)] = k); | ||
} | ||
return _results; | ||
}; | ||
Engine.prototype.ekid = function(k) { | ||
@@ -142,3 +155,3 @@ return this.key(k).ekid(); | ||
})(), | ||
lineno: 60 | ||
lineno: 68 | ||
})); | ||
@@ -216,3 +229,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 84 | ||
lineno: 92 | ||
})); | ||
@@ -239,3 +252,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 85 | ||
lineno: 93 | ||
})); | ||
@@ -276,20 +289,10 @@ __iced_deferrals._fulfill(); | ||
Engine.prototype.merge_private = function(eng2) { | ||
var err, i, key, _i, _len, _ref4; | ||
err = null; | ||
if (!this.key(eng2.primary).has_private()) { | ||
err = new Error("Expected a private key; got a public key!"); | ||
} else if (!this._merge_1_private(this.primary, eng2.primary)) { | ||
err = new Error("primary public key doesn't match private key"); | ||
} else if (this.subkeys.length !== eng2.subkeys.length) { | ||
err = new Error("Different number of subkeys"); | ||
} else { | ||
_ref4 = this.subkeys; | ||
var err, i, k, _i, _len, _ref4; | ||
err = this._merge_private_primary(eng2); | ||
if (err == null) { | ||
_ref4 = eng2.subkeys; | ||
for (i = _i = 0, _len = _ref4.length; _i < _len; i = ++_i) { | ||
key = _ref4[i]; | ||
if (err == null) { | ||
if (!this.key(eng2.subkeys[i]).has_private()) { | ||
err = new Error("Subkey " + i + " doesn't have a private key"); | ||
} else if (!this._merge_1_private(key, eng2.subkeys[i])) { | ||
err = new Error("Subkey " + i + " doesn't match its public key"); | ||
} | ||
k = _ref4[i]; | ||
if ((err = this._merge_private_subkey(k, i)) != null) { | ||
break; | ||
} | ||
@@ -301,2 +304,20 @@ } | ||
Engine.prototype._merge_private_primary = function(eng2) { | ||
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"); | ||
} | ||
return err; | ||
}; | ||
Engine.prototype._merge_private_subkey = function(k2, i) { | ||
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"); | ||
return err; | ||
}; | ||
Engine.prototype.unlock_keys = function(_arg, cb) { | ||
@@ -320,3 +341,3 @@ var asp, esc, passphrase, subkey, tsenc, ___iced_passed_deferral, __iced_deferrals, __iced_k; | ||
}, esc(__iced_deferrals.defer({ | ||
lineno: 124 | ||
lineno: 141 | ||
}))); | ||
@@ -363,3 +384,3 @@ __iced_deferrals._fulfill(); | ||
}, esc(__iced_deferrals.defer({ | ||
lineno: 126 | ||
lineno: 143 | ||
}))); | ||
@@ -467,3 +488,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 171 | ||
lineno: 188 | ||
})); | ||
@@ -500,3 +521,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 177 | ||
lineno: 194 | ||
})); | ||
@@ -691,3 +712,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 305 | ||
lineno: 322 | ||
}))); | ||
@@ -753,3 +774,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 314 | ||
lineno: 331 | ||
}))); | ||
@@ -819,3 +840,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 342 | ||
lineno: 359 | ||
})); | ||
@@ -870,3 +891,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 355 | ||
lineno: 372 | ||
})); | ||
@@ -910,3 +931,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 363 | ||
lineno: 380 | ||
})); | ||
@@ -939,3 +960,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 366 | ||
lineno: 383 | ||
})); | ||
@@ -968,3 +989,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 375 | ||
lineno: 392 | ||
})); | ||
@@ -1011,3 +1032,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 390 | ||
lineno: 407 | ||
})); | ||
@@ -1070,3 +1091,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 408 | ||
lineno: 425 | ||
})); | ||
@@ -1109,3 +1130,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 422 | ||
lineno: 439 | ||
})); | ||
@@ -1169,3 +1190,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 440 | ||
lineno: 457 | ||
})); | ||
@@ -1207,3 +1228,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 453 | ||
lineno: 470 | ||
})); | ||
@@ -1298,3 +1319,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 493 | ||
lineno: 510 | ||
})); | ||
@@ -1468,3 +1489,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 585 | ||
lineno: 602 | ||
})); | ||
@@ -1471,0 +1492,0 @@ __iced_deferrals._fulfill(); |
@@ -1,2 +0,2 @@ | ||
// Generated by IcedCoffeeScript 1.7.1-a | ||
// Generated by IcedCoffeeScript 1.7.1-b | ||
(function() { | ||
@@ -83,3 +83,3 @@ var Burner, C, Compressed, CreationTime, Issuer, Literal, OnePassSignature, PKESK, SEIPD, SHA512, SRF, Signature, WordArray, clearsign, encode, export_key_pgp, get_cipher, iced, make_esc, make_simple_literals, scrub_buffer, triplesec, unix_time, __iced_k, __iced_k_noop, _ref, _ref1, _ref2; | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._frame_literals" | ||
@@ -127,3 +127,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._sign" | ||
@@ -152,3 +152,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._sign" | ||
@@ -197,3 +197,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._compress" | ||
@@ -232,3 +232,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._make_session_key" | ||
@@ -273,3 +273,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._encrypt_session_key" | ||
@@ -300,3 +300,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._encrypt_session_key" | ||
@@ -335,3 +335,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._encrypt_payload" | ||
@@ -355,3 +355,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._encrypt_payload" | ||
@@ -371,3 +371,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._encrypt_payload" | ||
@@ -403,3 +403,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._encrypt" | ||
@@ -417,3 +417,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._encrypt" | ||
@@ -429,3 +429,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner._encrypt" | ||
@@ -456,3 +456,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner.burn" | ||
@@ -472,3 +472,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner.burn" | ||
@@ -488,3 +488,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner.burn" | ||
@@ -502,3 +502,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "Burner.burn" | ||
@@ -559,3 +559,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/burner.iced", | ||
funcname: "burn" | ||
@@ -570,3 +570,3 @@ }); | ||
})(), | ||
lineno: 180 | ||
lineno: 203 | ||
})); | ||
@@ -573,0 +573,0 @@ __iced_deferrals._fulfill(); |
@@ -227,3 +227,3 @@ // Generated by IcedCoffeeScript 1.7.1-b | ||
})(), | ||
lineno: 173 | ||
lineno: 171 | ||
})); | ||
@@ -286,3 +286,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 212 | ||
lineno: 210 | ||
})); | ||
@@ -334,3 +334,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 225 | ||
lineno: 223 | ||
})); | ||
@@ -373,3 +373,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 234 | ||
lineno: 232 | ||
})); | ||
@@ -399,3 +399,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 236 | ||
lineno: 234 | ||
})); | ||
@@ -449,3 +449,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 260 | ||
lineno: 258 | ||
})); | ||
@@ -490,3 +490,3 @@ __iced_deferrals._fulfill(); | ||
})(), | ||
lineno: 280 | ||
lineno: 278 | ||
})); | ||
@@ -565,3 +565,3 @@ __iced_deferrals._fulfill(); | ||
err = null; | ||
pt = this.skm.s2k_convention !== C.s2k_convention.none ? (key = this.skm.s2k.produce_key(passphrase, this.skm.cipher.key_size), decrypt({ | ||
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({ | ||
ciphertext: this.skm.payload, | ||
@@ -571,26 +571,28 @@ block_cipher_class: this.skm.cipher.klass, | ||
key: key | ||
})) : pt = this.skm.payload; | ||
switch (this.skm.s2k_convention) { | ||
case C.s2k_convention.sha1: | ||
end = pt.length - SHA1.output_size; | ||
h1 = pt.slice(end); | ||
pt = pt.slice(0, end); | ||
h2 = (new SHA1).bufhash(pt); | ||
if (!bufeq_secure(h1, h2)) { | ||
err = new Error("hash mismatch"); | ||
} | ||
break; | ||
case C.s2k_convention.checksum: | ||
case C.s2k_convention.none: | ||
end = pt.length - 2; | ||
c1 = pt.readUInt16BE(end); | ||
pt = pt.slice(0, end); | ||
c2 = calc_checksum(pt); | ||
if (c1 !== c2) { | ||
err = new Error("checksum mismatch"); | ||
} | ||
})); | ||
if (pt) { | ||
switch (this.skm.s2k_convention) { | ||
case C.s2k_convention.sha1: | ||
end = pt.length - SHA1.output_size; | ||
h1 = pt.slice(end); | ||
pt = pt.slice(0, end); | ||
h2 = (new SHA1).bufhash(pt); | ||
if (!bufeq_secure(h1, h2)) { | ||
err = new Error("hash mismatch"); | ||
} | ||
break; | ||
case C.s2k_convention.checksum: | ||
case C.s2k_convention.none: | ||
end = pt.length - 2; | ||
c1 = pt.readUInt16BE(end); | ||
pt = pt.slice(0, end); | ||
c2 = calc_checksum(pt); | ||
if (c1 !== c2) { | ||
err = new Error("checksum mismatch"); | ||
} | ||
} | ||
if (err == null) { | ||
err = this.key.read_priv(pt); | ||
} | ||
} | ||
if (err == null) { | ||
err = this.key.read_priv(pt); | ||
} | ||
return cb(err); | ||
@@ -715,10 +717,10 @@ }; | ||
} | ||
if (sym_enc_alg) { | ||
skm.cipher = symmetric.get_cipher(sym_enc_alg); | ||
iv_len = skm.cipher.klass.blockSize; | ||
skm.iv = this.slice.read_buffer(iv_len); | ||
} | ||
if ((skm.s2k_convention !== C.s2k_convention.none) && (skm.s2k.type === C.s2k.gnu)) { | ||
if ((skm.s2k_convention !== C.s2k_convention.none) && (skm.s2k.type === C.s2k.gnu_dummy)) { | ||
skm.payload = null; | ||
} else { | ||
if (sym_enc_alg) { | ||
skm.cipher = symmetric.get_cipher(sym_enc_alg); | ||
iv_len = skm.cipher.klass.blockSize; | ||
skm.iv = this.slice.read_buffer(iv_len); | ||
} | ||
skm.payload = this.slice.consume_rest_to_buffer(); | ||
@@ -725,0 +727,0 @@ } |
@@ -28,3 +28,3 @@ // Generated by IcedCoffeeScript 1.7.1-b | ||
S2K.prototype.read = function(slice) { | ||
var c, gnuExtType, match; | ||
var c; | ||
this.type = slice.read_uint8(); | ||
@@ -47,16 +47,3 @@ switch (this.type) { | ||
case C.s2k.gnu: | ||
if (input.read_buffer(3).toString('utf8') === "GNU") { | ||
this.set_hash_algorithm(this.read_uint8()); | ||
gnuExtType = 1000 + input.read_uint8(); | ||
match = true; | ||
this.type = gnuExtType((function() { | ||
if (gnuExtType === 1001) { | ||
} else { | ||
throw new ("unknown s2k gnu protection mode! " + gnuExtType); | ||
} | ||
})()); | ||
} else { | ||
throw new "Malformed GNU-extension"; | ||
} | ||
this.read_gnu_extensions(slice); | ||
break; | ||
@@ -69,2 +56,18 @@ default: | ||
S2K.prototype.read_gnu_extensions = function(slice) { | ||
var buf, gnu_ext_type, id, version; | ||
version = slice.read_uint8(); | ||
if ((id = (buf = slice.read_buffer(3)).toString('utf8')) === "GNU") { | ||
gnu_ext_type = slice.read_uint8() + 1000; | ||
switch (gnu_ext_type) { | ||
case 1001: | ||
return this.type = C.s2k.gnu_dummy; | ||
default: | ||
throw new ("unknown s2k gnu protection mode: " + gnu_ext_type); | ||
} | ||
} else { | ||
throw new Error("Malformed GNU-extension: " + ext); | ||
} | ||
}; | ||
S2K.prototype.write = function(passphrase, salt, c, keysize) { | ||
@@ -71,0 +74,0 @@ var type; |
@@ -10,3 +10,3 @@ { | ||
"author": "Maxwell Krohn", | ||
"version": "0.1.8", | ||
"version": "0.1.9", | ||
"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
837289
12285