[ 
https://issues.apache.org/jira/browse/MRESOLVER-516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17831877#comment-17831877
 ] 

ASF GitHub Bot commented on MRESOLVER-516:
------------------------------------------

gnodet commented on code in PR #448:
URL: https://github.com/apache/maven-resolver/pull/448#discussion_r1543239313


##########
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:
   Especially, if we call `getChars()` a few lines later...





> Align GPG signature generator
> -----------------------------
>
>                 Key: MRESOLVER-516
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-516
>             Project: Maven Resolver
>          Issue Type: Task
>          Components: Resolver
>            Reporter: Tamas Cservenak
>            Assignee: Tamas Cservenak
>            Priority: Major
>             Fix For: 2.0.0, 2.0.0-alpha-9
>
>




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to