mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-05 03:55:58 +01:00
Fix NPE when sop generate-key --with-key-password is used with multiple uids
Fixes #351
This commit is contained in:
parent
43a29729ad
commit
05ae631a12
2 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue