gnodet commented on code in PR #448:
URL: https://github.com/apache/maven-resolver/pull/448#discussion_r1543240703
##########
maven-resolver-generator-gnupg/src/main/java/org/eclipse/aether/generator/gnupg/loaders/GpgAgentPasswordLoader.java:
##########
@@ -102,23 +114,43 @@ private String load(long keyId, Path socketPath) throws
IOException {
os.flush();
expectOK(in);
}
- String hexKeyId = Long.toHexString(keyId & 0xFFFFFFFFL);
+ String hexKeyFingerprint = Hex.toHexString(fingerprint);
+ String displayFingerprint =
hexKeyFingerprint.toUpperCase(Locale.ROOT);
//
https://unix.stackexchange.com/questions/71135/how-can-i-find-out-what-keys-gpg-agent-has-cached-like-how-ssh-add-l-shows-yo
- String instruction = "GET_PASSPHRASE " + hexKeyId + " " +
"Passphrase+incorrect"
- + " GnuPG+Key+Passphrase
Enter+passphrase+for+encrypted+GnuPG+key+" + hexKeyId
+ String instruction = "GET_PASSPHRASE "
+ + (!interactive ? "--no-ask " : "")
+ + hexKeyFingerprint
+ + " "
+ + "X "
+ + "GnuPG+Passphrase "
+ +
"Please+enter+the+passphrase+to+unlock+the+OpenPGP+secret+key+with+fingerprint:+"
+ + displayFingerprint
+ "+to+use+it+for+signing+Maven+Artifacts\n";
os.write((instruction).getBytes());
os.flush();
- return new String(Hex.decode(expectOK(in).trim()));
+ String pw = mayExpectOK(in);
Review Comment:
So just return `Hex.decode(pw.trim())` below...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]