diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f0f8f71..e67aa3fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ SPDX-License-Identifier: CC0-1.0 # PGPainless Changelog +## 1.3.15-SNAPSHOT +- Fix crash in `sop generate-key --with-key-password` when more then one user-id is given + ## 1.3.14 - Bump `bcpg` to `1.72.3` - Fix DSA key parameter check diff --git a/pgpainless-sop/src/main/java/org/pgpainless/sop/GenerateKeyImpl.java b/pgpainless-sop/src/main/java/org/pgpainless/sop/GenerateKeyImpl.java index 893c8dd8..e732a6cc 100644 --- a/pgpainless-sop/src/main/java/org/pgpainless/sop/GenerateKeyImpl.java +++ b/pgpainless-sop/src/main/java/org/pgpainless/sop/GenerateKeyImpl.java @@ -55,6 +55,7 @@ public class GenerateKeyImpl implements GenerateKey { throw new SOPGPException.MissingArg("Missing user-id."); } + Passphrase passphraseCopy = new Passphrase(passphrase.getChars()); // generateKeyRing clears the original passphrase PGPSecretKeyRing key; try { key = PGPainless.generateKeyRing() @@ -64,7 +65,7 @@ public class GenerateKeyImpl implements GenerateKey { SecretKeyRingEditorInterface editor = PGPainless.modifyKeyRing(key); while (userIdIterator.hasNext()) { - editor.addUserId(userIdIterator.next(), SecretKeyRingProtector.unprotectedKeys()); + editor.addUserId(userIdIterator.next(), SecretKeyRingProtector.unlockAnyKeyWith(passphraseCopy)); } key = editor.done();