diff --git a/lib/openpgp/packet/signature.js b/lib/openpgp/packet/signature.js index ac66c249..70263928 100644 --- a/lib/openpgp/packet/signature.js +++ b/lib/openpgp/packet/signature.js @@ -1,6 +1,6 @@ // Generated by IcedCoffeeScript 108.0.11 (function() { - var C, CreationTime, EmbeddedSignature, Experimental, ExpirationTime, Exportable, Features, Issuer, IssuerFingerprint, KeyExpirationTime, KeyFlags, KeyServerPreferences, NotationData, Packet, Parser, PolicyURI, Preference, PreferredAEADAlgorithms, PreferredCompressionAlgorithms, PreferredHashAlgorithms, PreferredKeyServer, PreferredSymmetricAlgorithms, PrimaryUserId, ReasonForRevocation, RegularExpression, Revocable, RevocationKey, S, SHA1, SHA512, Signature, SignatureTarget, Signature_v2, Signature_v2_or_v3, Signature_v3, SignersUserID, SlicerBuffer, SubPacket, Time, Trust, alloc_or_throw, assert, asymmetric, bufeq_secure, encode_length, iced, make_esc, make_time_packet, packetsigs, uint_to_buffer, unix_time, util, __iced_k, __iced_k_noop, _ref, _ref1, _ref2, + var C, CreationTime, EmbeddedSignature, Experimental, ExpirationTime, Exportable, Features, Issuer, IssuerFingerprint, KeyExpirationTime, KeyFlags, KeyServerPreferences, NotationData, Packet, Parser, PolicyURI, Preference, PreferredAEADAlgorithms, PreferredCompressionAlgorithms, PreferredHashAlgorithms, PreferredKeyServer, PreferredSymmetricAlgorithms, PrimaryUserId, ReasonForRevocation, RegularExpression, Revocable, RevocationKey, S, SHA1, SHA512, Signature, SignatureTarget, Signature_v2, Signature_v2_or_v3, Signature_v3, SignersUserID, SlicerBuffer, SubPacket, Time, Trust, Unknown, alloc_or_throw, assert, asymmetric, bufeq_secure, encode_length, iced, make_esc, make_time_packet, packetsigs, uint_to_buffer, unix_time, util, __iced_k, __iced_k_noop, _ref, _ref1, _ref2, __hasProp = {}.hasOwnProperty, __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; }; @@ -837,6 +837,26 @@ })(SubPacket); + Unknown = (function(_super) { + __extends(Unknown, _super); + + function Unknown(buf, type) { + this.buf = buf; + this.type = type; + } + + Unknown.parse = function(slice, type) { + return new Unknown(slice.consume_rest_to_buffer(), type); + }; + + Unknown.prototype._v_to_buffer = function() { + return this.buf; + }; + + return Unknown; + + })(SubPacket); + Time = (function(_super) { __extends(Time, _super); @@ -1527,6 +1547,8 @@ default: if (type >= S.experimental_low && type <= S.experimental_high) { return Experimental; + } else if (!critical) { + return Unknown; } else { throw new Error("Unknown signature subpacket: " + type); } diff --git a/src/openpgp/packet/signature.iced b/src/openpgp/packet/signature.iced index 702ef52c..e8cb5de0 100644 --- a/src/openpgp/packet/signature.iced +++ b/src/openpgp/packet/signature.iced @@ -466,6 +466,15 @@ class Experimental extends SubPacket #------------ +# Ignore unless critical. +class Unknown extends SubPacket + constructor : (@buf, @type) -> + @parse : (slice, type) -> + new Unknown slice.consume_rest_to_buffer(), type + _v_to_buffer : () -> @buf + +#------------ + class Time extends SubPacket constructor : (type, @time) -> @never_expires = (@time is 0) @@ -809,6 +818,7 @@ class Parser when S.preferred_aead_algos then PreferredAEADAlgorithms else if type >= S.experimental_low and type <= S.experimental_high then Experimental + else if not critical then Unknown else throw new Error "Unknown signature subpacket: #{type}" ret = klass.parse @slice, type ret.set_opts { critical, five_byte_len }