From 668a9bbe7033f3f475576209305eb57a54306d29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Obernd=C3=B6rfer?= Date: Sat, 3 Oct 2015 15:57:03 +0200 Subject: [PATCH] Throw exception on unsupported S2K type. --- src/type/s2k.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/type/s2k.js b/src/type/s2k.js index 683d1e16..e4d0fab7 100644 --- a/src/type/s2k.js +++ b/src/type/s2k.js @@ -125,6 +125,10 @@ S2K.prototype.write = function () { bytes += this.salt; bytes += String.fromCharCode(this.c); break; + case 'gnu': + throw new Error("GNU s2k type not supported."); + default: + throw new Error("Unknown s2k type."); } return bytes; @@ -165,6 +169,12 @@ S2K.prototype.produce_key = function (passphrase, numBytes) { isp = isp.substr(0, count); return crypto.hash.digest(algorithm, prefix + isp); + + case 'gnu': + throw new Error("GNU s2k type not supported."); + + default: + throw new Error("Unknown s2k type."); } }