Skip to content

Commit

Permalink
[MGPG-99] Make sure newline is added to input stream (#76)
Browse files Browse the repository at this point in the history
When passphrase is being supplied with `--passphrase-fd 0`.

---

https://issues.apache.org/jira/browse/MGPG-99
  • Loading branch information
cstamas committed Mar 5, 2024
1 parent 9a73f90 commit 23b64f2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx
cmd.createArg().setValue("0");

// Prepare the input stream which will be used to pass the passphrase to the executable
in = new ByteArrayInputStream(passphrase.getBytes());
if (!passphrase.endsWith(System.lineSeparator())) {
in = new ByteArrayInputStream((passphrase + System.lineSeparator()).getBytes());
} else {
in = new ByteArrayInputStream(passphrase.getBytes());
}
}

if (null != keyname) {
Expand Down

0 comments on commit 23b64f2

Please sign in to comment.