Skip to content

Commit 23b64f2

Browse files
authored
[MGPG-99] Make sure newline is added to input stream (#76)
When passphrase is being supplied with `--passphrase-fd 0`. --- https://issues.apache.org/jira/browse/MGPG-99
1 parent 9a73f90 commit 23b64f2

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/apache/maven/plugins/gpg/GpgSigner.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ protected void generateSignatureForFile(File file, File signature) throws MojoEx
108108
cmd.createArg().setValue("0");
109109

110110
// Prepare the input stream which will be used to pass the passphrase to the executable
111-
in = new ByteArrayInputStream(passphrase.getBytes());
111+
if (!passphrase.endsWith(System.lineSeparator())) {
112+
in = new ByteArrayInputStream((passphrase + System.lineSeparator()).getBytes());
113+
} else {
114+
in = new ByteArrayInputStream(passphrase.getBytes());
115+
}
112116
}
113117

114118
if (null != keyname) {

0 commit comments

Comments
 (0)