Comparing version 0.0.10 to 0.0.11
@@ -0,1 +1,14 @@ | ||
## 0.0.11 (2014-2-25) | ||
Bugfixes: | ||
- Finish support for v3 Signatures, and close #34 | ||
- Fix bug in Revocation Key sub packets (type=12), in which we weren't reading in any bytes of the signature. | ||
- Upgrade to PGP-utils v0.0.15 to handle null email addresses in UserIds | ||
Features | ||
- Support signature type 0x1F ("signature directly on a key") | ||
- Support signature type 0x28 ("Subkey revocation"). See keybase/keybase-issues#27 | ||
## 0.0.10 (2014-2-21) | ||
@@ -2,0 +15,0 @@ |
@@ -60,2 +60,3 @@ // Generated by IcedCoffeeScript 1.7.1-a | ||
primary_binding: 0x19, | ||
direct: 0x1f, | ||
key_revocation: 0x20, | ||
@@ -62,0 +63,0 @@ subkey_revocation: 0x28, |
@@ -100,3 +100,3 @@ // Generated by IcedCoffeeScript 1.7.1-a | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/dsa.iced", | ||
filename: "/home/max/src/kbpgp/src/dsa.iced", | ||
funcname: "Priv.sign" | ||
@@ -160,6 +160,7 @@ }); | ||
Pair.prototype.verify_unpad_and_check_hash = function(sig, data, hasher, cb) { | ||
var err, hash, v, ___iced_passed_deferral, __iced_deferrals, __iced_k, _ref4; | ||
Pair.prototype.verify_unpad_and_check_hash = function(_arg, cb) { | ||
var data, err, hash, hasher, sig, v, ___iced_passed_deferral, __iced_deferrals, __iced_k, _ref4; | ||
__iced_k = __iced_k_noop; | ||
___iced_passed_deferral = iced.findDeferral(arguments); | ||
sig = _arg.sig, data = _arg.data, hasher = _arg.hasher, hash = _arg.hash; | ||
err = null; | ||
@@ -169,3 +170,3 @@ if (Buffer.isBuffer(sig)) { | ||
} | ||
hash = hasher(data); | ||
hash || (hash = hasher(data)); | ||
(function(_this) { | ||
@@ -179,3 +180,3 @@ return (function(__iced_k) { | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/dsa.iced", | ||
filename: "/home/max/src/kbpgp/src/dsa.iced", | ||
funcname: "Pair.verify_unpad_and_check_hash" | ||
@@ -214,3 +215,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/dsa.iced", | ||
filename: "/home/max/src/kbpgp/src/dsa.iced", | ||
funcname: "Pair.pad_and_sign" | ||
@@ -217,0 +218,0 @@ }); |
@@ -55,3 +55,3 @@ // Generated by IcedCoffeeScript 1.7.1-a | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/elgamal.iced", | ||
filename: "/home/max/src/kbpgp/src/elgamal.iced", | ||
funcname: "Pub.encrypt" | ||
@@ -157,3 +157,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/elgamal.iced", | ||
filename: "/home/max/src/kbpgp/src/elgamal.iced", | ||
funcname: "Pair.pad_and_encrypt" | ||
@@ -179,3 +179,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/elgamal.iced", | ||
filename: "/home/max/src/kbpgp/src/elgamal.iced", | ||
funcname: "Pair.pad_and_encrypt" | ||
@@ -216,3 +216,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/elgamal.iced", | ||
filename: "/home/max/src/kbpgp/src/elgamal.iced", | ||
funcname: "Pair.decrypt_and_unpad" | ||
@@ -219,0 +219,0 @@ }); |
@@ -64,3 +64,3 @@ // Generated by IcedCoffeeScript 1.7.1-a | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/kbpgp/src/keybase/sign.iced" | ||
filename: "/home/max/src/kbpgp/src/keybase/sign.iced" | ||
}); | ||
@@ -116,5 +116,9 @@ key.pad_and_sign(payload, { | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/kbpgp/src/keybase/sign.iced" | ||
filename: "/home/max/src/kbpgp/src/keybase/sign.iced" | ||
}); | ||
key.verify_unpad_and_check_hash(sig.sig, payload, hasher, __iced_deferrals.defer({ | ||
key.verify_unpad_and_check_hash({ | ||
sig: sig.sig, | ||
data: payload, | ||
hasher: hasher | ||
}, __iced_deferrals.defer({ | ||
assign_fn: (function() { | ||
@@ -121,0 +125,0 @@ return function() { |
// Generated by IcedCoffeeScript 1.7.1-a | ||
(function() { | ||
var C, CreationTime, EmbeddedSignature, ExpirationTime, Exportable, Features, Issuer, KeyExpirationTime, KeyFlags, KeyServerPreferences, NotationData, Packet, Parser, PolicyURI, Preference, PreferredCompressionAlgorithms, PreferredHashAlgorithms, PreferredKeyServer, PreferredSymmetricAlgorithms, PrimaryUserId, ReasonForRevocation, RegularExpression, Revocable, RevocationKey, S, SHA1, SHA512, Signature, SignatureTarget, SignersUserID, SubPacket, Time, Trust, alloc_or_throw, assert, asymmetric, encode_length, iced, make_time_packet, packetsigs, uint_to_buffer, unix_time, util, __iced_k, __iced_k_noop, _ref, _ref1, _ref2, | ||
var C, CreationTime, EmbeddedSignature, ExpirationTime, Exportable, Features, Issuer, KeyExpirationTime, KeyFlags, KeyServerPreferences, NotationData, Packet, Parser, PolicyURI, Preference, PreferredCompressionAlgorithms, PreferredHashAlgorithms, PreferredKeyServer, PreferredSymmetricAlgorithms, PrimaryUserId, ReasonForRevocation, RegularExpression, Revocable, RevocationKey, S, SHA1, SHA512, Signature, SignatureTarget, Signature_v3, SignersUserID, SlicerBuffer, SubPacket, Time, Trust, alloc_or_throw, assert, asymmetric, encode_length, iced, make_time_packet, packetsigs, uint_to_buffer, unix_time, util, __iced_k, __iced_k_noop, _ref, _ref1, _ref2, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -30,2 +30,84 @@ __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; }; | ||
SlicerBuffer = require('../buffer').SlicerBuffer; | ||
Signature_v3 = (function(_super) { | ||
__extends(Signature_v3, _super); | ||
function Signature_v3(_arg) { | ||
this.key = _arg.key, this.hasher = _arg.hasher, this.key_id = _arg.key_id, this.sig_data = _arg.sig_data, this.public_key_class = _arg.public_key_class, this.signed_hash_value_hash = _arg.signed_hash_value_hash, this.time = _arg.time, this.sig = _arg.sig, this.type = _arg.type, this.version = _arg.version; | ||
if (this.hasher == null) { | ||
this.hasher = SHA512; | ||
} | ||
this._framed_output = null; | ||
} | ||
Signature_v3.prototype.get_key_id = function() { | ||
return this.key_id; | ||
}; | ||
Signature_v3.prototype.gen_prefix = function() { | ||
return Buffer.concat([new Buffer([C.versions.signature.V3, this.type], uint_to_buffer(32, this.time), this.key_id, new Buffer([this.key.type, this.hasher.type]))]); | ||
}; | ||
Signature_v3.prototype.prepare_payload = function(data_packets) { | ||
var bufs, dp; | ||
bufs = (function() { | ||
var _i, _len, _results; | ||
_results = []; | ||
for (_i = 0, _len = data_packets.length; _i < _len; _i++) { | ||
dp = data_packets[_i]; | ||
_results.push(dp.to_signature_payload()); | ||
} | ||
return _results; | ||
})(); | ||
bufs.push(new Buffer([this.type]), uint_to_buffer(32, this.time)); | ||
return Buffer.concat(bufs); | ||
}; | ||
Signature_v3.prototype.verify = function(data_packets, cb) { | ||
var b, err, hash, payload, s, v, ___iced_passed_deferral, __iced_deferrals, __iced_k; | ||
__iced_k = __iced_k_noop; | ||
___iced_passed_deferral = iced.findDeferral(arguments); | ||
payload = this.prepare_payload(data_packets); | ||
hash = this.hasher(payload); | ||
s = new SlicerBuffer(hash); | ||
v = s.read_uint16(); | ||
(function(_this) { | ||
return (function(__iced_k) { | ||
if (v !== (b = _this.signed_hash_value_hash)) { | ||
return __iced_k(err = new Error("quick hash check failed: " + v + " != " + b)); | ||
} else { | ||
(function(__iced_k) { | ||
__iced_deferrals = new iced.Deferrals(__iced_k, { | ||
parent: ___iced_passed_deferral, | ||
filename: "/home/max/src/kbpgp/src/openpgp/packet/signature.iced", | ||
funcname: "Signature_v3.verify" | ||
}); | ||
_this.key.verify_unpad_and_check_hash({ | ||
hash: hash, | ||
hasher: _this.hasher, | ||
sig: _this.sig | ||
}, __iced_deferrals.defer({ | ||
assign_fn: (function() { | ||
return function() { | ||
return err = arguments[0]; | ||
}; | ||
})(), | ||
lineno: 60 | ||
})); | ||
__iced_deferrals._fulfill(); | ||
})(__iced_k); | ||
} | ||
}); | ||
})(this)((function(_this) { | ||
return function() { | ||
return cb(err); | ||
}; | ||
})(this)); | ||
}; | ||
return Signature_v3; | ||
})(Packet); | ||
Signature = (function(_super) { | ||
@@ -35,3 +117,3 @@ __extends(Signature, _super); | ||
function Signature(_arg) { | ||
this.key = _arg.key, this.hasher = _arg.hasher, this.key_id = _arg.key_id, this.sig_data = _arg.sig_data, this.public_key_class = _arg.public_key_class, this.signed_hash_value_hash = _arg.signed_hash_value_hash, this.hashed_subpackets = _arg.hashed_subpackets, this.time = _arg.time, this.sig = _arg.sig, this.type = _arg.type, this.unhashed_subpackets = _arg.unhashed_subpackets; | ||
this.key = _arg.key, this.hasher = _arg.hasher, this.key_id = _arg.key_id, this.sig_data = _arg.sig_data, this.public_key_class = _arg.public_key_class, this.signed_hash_value_hash = _arg.signed_hash_value_hash, this.hashed_subpackets = _arg.hashed_subpackets, this.time = _arg.time, this.sig = _arg.sig, this.type = _arg.type, this.unhashed_subpackets = _arg.unhashed_subpackets, this.version = _arg.version; | ||
if (this.hasher == null) { | ||
@@ -120,3 +202,3 @@ this.hasher = SHA512; | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/packet/signature.iced", | ||
filename: "/home/max/src/kbpgp/src/openpgp/packet/signature.iced", | ||
funcname: "Signature.write_unframed" | ||
@@ -132,3 +214,3 @@ }); | ||
})(), | ||
lineno: 71 | ||
lineno: 124 | ||
})); | ||
@@ -154,3 +236,3 @@ __iced_deferrals._fulfill(); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/packet/signature.iced", | ||
filename: "/home/max/src/kbpgp/src/openpgp/packet/signature.iced", | ||
funcname: "Signature.write" | ||
@@ -165,3 +247,3 @@ }); | ||
})(), | ||
lineno: 84 | ||
lineno: 137 | ||
})); | ||
@@ -211,3 +293,3 @@ __iced_deferrals._fulfill(); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/packet/signature.iced", | ||
filename: "/home/max/src/kbpgp/src/openpgp/packet/signature.iced", | ||
funcname: "Signature.verify" | ||
@@ -221,3 +303,3 @@ }); | ||
})(), | ||
lineno: 113 | ||
lineno: 166 | ||
})); | ||
@@ -268,3 +350,3 @@ __iced_deferrals._fulfill(); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/packet/signature.iced", | ||
filename: "/home/max/src/kbpgp/src/openpgp/packet/signature.iced", | ||
funcname: "Signature.verify" | ||
@@ -278,3 +360,3 @@ }); | ||
})(), | ||
lineno: 123 | ||
lineno: 176 | ||
})); | ||
@@ -326,2 +408,3 @@ __iced_deferrals._fulfill(); | ||
case T.primary_binding: | ||
case T.subkey_revocation: | ||
packets = []; | ||
@@ -337,2 +420,4 @@ if (data_packets.length !== 1) { | ||
return packets; | ||
case T.direct: | ||
return [this.primary].concat(data_packets); | ||
default: | ||
@@ -361,6 +446,10 @@ err = new Error("cannot verify sigtype " + this.type); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/openpgp/packet/signature.iced", | ||
filename: "/home/max/src/kbpgp/src/openpgp/packet/signature.iced", | ||
funcname: "Signature._verify" | ||
}); | ||
_this.key.verify_unpad_and_check_hash(_this.sig, payload, _this.hasher, __iced_deferrals.defer({ | ||
_this.key.verify_unpad_and_check_hash({ | ||
sig: _this.sig, | ||
data: payload, | ||
hasher: _this.hasher | ||
}, __iced_deferrals.defer({ | ||
assign_fn: (function() { | ||
@@ -371,3 +460,3 @@ return function() { | ||
})(), | ||
lineno: 170 | ||
lineno: 226 | ||
})); | ||
@@ -613,3 +702,3 @@ __iced_deferrals._fulfill(); | ||
Exportable.parse = function(slice) { | ||
return new Exportable(slice.read_uint8() === 1); | ||
return new Exportable(slice.read_uint8()); | ||
}; | ||
@@ -677,3 +766,3 @@ | ||
Revocable.parse = function(slice) { | ||
return new Revocable(slice.read_uint8() === 1); | ||
return new Revocable(slice.read_uint8()); | ||
}; | ||
@@ -733,3 +822,3 @@ | ||
ka = slice.read_uint8(); | ||
fp = slice.read_buffer(SHA1.output_size); | ||
fp = slice.read_buffer(SHA1.output_length); | ||
return new RevocationKey(kc, ka, fp); | ||
@@ -1050,10 +1139,11 @@ }; | ||
o.type = this.slice.read_uint8(); | ||
o.time = new Date(this.slice.read_uint32() * 1000); | ||
o.time = this.slice.read_uint32(); | ||
o.sig_data = this.slice.peek_rest_to_buffer(); | ||
o.key_id = this.slice.read_buffer(8); | ||
o.public_key_class = asymmetric.get_class(this.slice.read_uint8()); | ||
o.hash = alloc_or_throw(this.slice.read_uint8()); | ||
o.hasher = alloc_or_throw(this.slice.read_uint8()); | ||
o.signed_hash_value_hash = this.slice.read_uint16(); | ||
o.sig = o.public_key_class.parse_sig(this.slice); | ||
return new Signature(o); | ||
o.version = 3; | ||
return new Signature_v3(o); | ||
}; | ||
@@ -1090,2 +1180,3 @@ | ||
o.sig = o.public_key_class.parse_sig(this.slice); | ||
o.version = 4; | ||
return new Signature(o); | ||
@@ -1092,0 +1183,0 @@ }; |
@@ -170,3 +170,3 @@ // Generated by IcedCoffeeScript 1.7.1-a | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Priv.mod_pow_d_crt" | ||
@@ -289,3 +289,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.sanity_check" | ||
@@ -306,3 +306,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.sanity_check" | ||
@@ -335,3 +335,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.sanity_check" | ||
@@ -352,3 +352,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.sanity_check" | ||
@@ -456,3 +456,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.pad_and_encrypt" | ||
@@ -478,3 +478,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.pad_and_encrypt" | ||
@@ -515,3 +515,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.decrypt_and_unpad" | ||
@@ -553,3 +553,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.pad_and_sign" | ||
@@ -574,6 +574,7 @@ }); | ||
Pair.prototype.verify_unpad_and_check_hash = function(sig, data, hasher, cb) { | ||
var b, err, hd1, hd2, v, ___iced_passed_deferral, __iced_deferrals, __iced_k, _ref5; | ||
Pair.prototype.verify_unpad_and_check_hash = function(_arg, cb) { | ||
var b, data, err, hash, hasher, hd1, sig, v, ___iced_passed_deferral, __iced_deferrals, __iced_k, _ref5; | ||
__iced_k = __iced_k_noop; | ||
___iced_passed_deferral = iced.findDeferral(arguments); | ||
sig = _arg.sig, data = _arg.data, hasher = _arg.hasher, hash = _arg.hash; | ||
err = null; | ||
@@ -589,3 +590,3 @@ if (Buffer.isBuffer(sig)) { | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.verify_unpad_and_check_hash" | ||
@@ -606,3 +607,3 @@ }); | ||
_ref6 = emsa_pkcs1_decode(b, hasher), err = _ref6[0], hd1 = _ref6[1]; | ||
return __iced_k(err == null ? (hd2 = hasher(data), !bufeq_secure(hd1, hd2) ? err = new Error("hash mismatch") : void 0) : void 0); | ||
return __iced_k(err == null ? (hash || (hash = hasher(data)), !bufeq_secure(hd1, hash) ? err = new Error("hash mismatch") : void 0) : void 0); | ||
}); | ||
@@ -658,3 +659,3 @@ } else { | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.generate" | ||
@@ -680,3 +681,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.generate" | ||
@@ -695,3 +696,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.generate" | ||
@@ -717,3 +718,3 @@ }); | ||
parent: ___iced_passed_deferral, | ||
filename: "/Users/max/src/keybase/kbpgp/src/rsa.iced", | ||
filename: "/home/max/src/kbpgp/src/rsa.iced", | ||
funcname: "Pair.generate" | ||
@@ -720,0 +721,0 @@ }); |
@@ -10,3 +10,3 @@ { | ||
"author": "Maxwell Krohn", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"license": "BSD-3-Clause", | ||
@@ -28,3 +28,3 @@ "main": "./lib/main.js", | ||
"bn": ">=0.0.2", | ||
"pgp-utils": ">=0.0.14" | ||
"pgp-utils": ">=0.0.15" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
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
806644
11830
Updatedpgp-utils@>=0.0.15