Throw exception on unsupported S2K type.

This commit is contained in:
Thomas Oberndörfer 2015-10-03 15:57:03 +02:00
parent c266c01b80
commit 668a9bbe70

View File

@ -125,6 +125,10 @@ S2K.prototype.write = function () {
bytes += this.salt; bytes += this.salt;
bytes += String.fromCharCode(this.c); bytes += String.fromCharCode(this.c);
break; break;
case 'gnu':
throw new Error("GNU s2k type not supported.");
default:
throw new Error("Unknown s2k type.");
} }
return bytes; return bytes;
@ -165,6 +169,12 @@ S2K.prototype.produce_key = function (passphrase, numBytes) {
isp = isp.substr(0, count); isp = isp.substr(0, count);
return crypto.hash.digest(algorithm, prefix + isp); return crypto.hash.digest(algorithm, prefix + isp);
case 'gnu':
throw new Error("GNU s2k type not supported.");
default:
throw new Error("Unknown s2k type.");
} }
} }