Skip to content
Permalink
Browse files

Throw exception on unsupported S2K type.

  • Loading branch information...
toberndo committed Oct 3, 2015
1 parent c266c01 commit 668a9bbe7033f3f475576209305eb57a54306d29
Showing with 10 additions and 0 deletions.
  1. +10 −0 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.");
}
}

0 comments on commit 668a9bb

Please sign in to comment.
You can’t perform that action at this time.