mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2026-03-20 23:28:58 +00:00
Throw when trying to encrypt a key that's already encrypted (#950)
This commit is contained in:
@@ -273,6 +273,10 @@ SecretKey.prototype.encrypt = async function (passphrase) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.isDecrypted()) {
|
||||
throw new Error('Key packet is already encrypted');
|
||||
}
|
||||
|
||||
if (this.isDecrypted() && !passphrase) {
|
||||
this.s2k_usage = 0;
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user