Skip to content
Permalink
Browse files Browse the repository at this point in the history
Throw exception on unsupported S2K type.
  • Loading branch information
toberndo committed Oct 3, 2015
1 parent c266c01 commit 668a9bb
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/type/s2k.js
Expand Up @@ -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;
Expand Down Expand Up @@ -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.");
}
}

Expand Down

0 comments on commit 668a9bb

Please sign in to comment.