]> source.dussan.org Git - jgit.git/commitdiff
SSH signing: prepare config 23/1202323/3
authorThomas Wolf <twolf@apache.org>
Sat, 28 Sep 2024 13:50:45 +0000 (15:50 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Tue, 22 Oct 2024 11:16:51 +0000 (13:16 +0200)
Include the SSH specifics in the GpgConfig so that we will have access
to these configs later on.

Change-Id: Iad3d6f2bdb5ba879e1672368c82d367b8ccd246c
Signed-off-by: Thomas Wolf <twolf@apache.org>
org.eclipse.jgit/src/org/eclipse/jgit/lib/ConfigConstants.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/GpgConfig.java

index c5f27688becb794ddbc73a0455925cba54a3c902..a57f1b714a750fdf389185020129e01b9b8198fc 100644 (file)
@@ -205,8 +205,37 @@ public final class ConfigConstants {
         */
        public static final String CONFIG_KEY_SIGNINGKEY = "signingKey";
 
+       /**
+        * The "ssh" subsection key.
+        *
+        * @since 7.1
+        */
+       public static final String CONFIG_SSH_SUBSECTION = "ssh";
+
+       /**
+        * The "defaultKeyCommand" key.
+        *
+        * @since 7.1
+        */
+       public static final String CONFIG_KEY_SSH_DEFAULT_KEY_COMMAND = "defaultKeyCommand";
+
+       /**
+        * The "allowedSignersFile" key.
+        *
+        * @since 7.1
+        */
+       public static final String CONFIG_KEY_SSH_ALLOWED_SIGNERS_FILE = "allowedSignersFile";
+
+       /**
+        * The "revocationFile" key,
+        *
+        * @since 7.1
+        */
+       public static final String CONFIG_KEY_SSH_REVOCATION_FILE = "revocationFile";
+
        /**
         * The "commit" section
+        *
         * @since 5.2
         */
        public static final String CONFIG_COMMIT_SECTION = "commit";
index fb5c904215215274b14d2ae3c287b743775ecf88..76ed36a6e56562a68835b2870d7740c2f0329286 100644 (file)
@@ -61,6 +61,12 @@ public class GpgConfig {
 
        private final boolean forceAnnotated;
 
+       private final String sshDefaultKeyCommand;
+
+       private final String sshAllowedSignersFile;
+
+       private final String sshRevocationFile;
+
        /**
         * Create a new GPG config that reads the configuration from config.
         *
@@ -88,6 +94,17 @@ public class GpgConfig {
                                ConfigConstants.CONFIG_KEY_GPGSIGN, false);
                forceAnnotated = config.getBoolean(ConfigConstants.CONFIG_TAG_SECTION,
                                ConfigConstants.CONFIG_KEY_FORCE_SIGN_ANNOTATED, false);
+               sshDefaultKeyCommand = config.getString(
+                               ConfigConstants.CONFIG_GPG_SECTION,
+                               ConfigConstants.CONFIG_SSH_SUBSECTION,
+                               ConfigConstants.CONFIG_KEY_SSH_DEFAULT_KEY_COMMAND);
+               sshAllowedSignersFile = config.getString(
+                               ConfigConstants.CONFIG_GPG_SECTION,
+                               ConfigConstants.CONFIG_SSH_SUBSECTION,
+                               ConfigConstants.CONFIG_KEY_SSH_ALLOWED_SIGNERS_FILE);
+               sshRevocationFile = config.getString(ConfigConstants.CONFIG_GPG_SECTION,
+                               ConfigConstants.CONFIG_SSH_SUBSECTION,
+                               ConfigConstants.CONFIG_KEY_SSH_REVOCATION_FILE);
        }
 
        /**
@@ -151,4 +168,37 @@ public class GpgConfig {
        public boolean isSignAnnotated() {
                return forceAnnotated;
        }
+
+       /**
+        * Retrieves the value of git config {@code gpg.ssh.defaultKeyCommand}.
+        *
+        * @return the value of {@code gpg.ssh.defaultKeyCommand}
+        *
+        * @since 7.1
+        */
+       public String getSshDefaultKeyCommand() {
+               return sshDefaultKeyCommand;
+       }
+
+       /**
+        * Retrieves the value of git config {@code gpg.ssh.allowedSignersFile}.
+        *
+        * @return the value of {@code gpg.ssh.allowedSignersFile}
+        *
+        * @since 7.1
+        */
+       public String getSshAllowedSignersFile() {
+               return sshAllowedSignersFile;
+       }
+
+       /**
+        * Retrieves the value of git config {@code gpg.ssh.revocationFile}.
+        *
+        * @return the value of {@code gpg.ssh.revocationFile}
+        *
+        * @since 7.1
+        */
+       public String getSshRevocationFile() {
+               return sshRevocationFile;
+       }
 }