View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.eclipse.aether.generator.gnupg;
20  
21  import org.eclipse.aether.ConfigurationProperties;
22  import org.eclipse.aether.RepositorySystemSession;
23  
24  /**
25   * Configuration for GPG Signer.
26   *
27   * @since 2.0.0
28   */
29  public final class GnupgConfigurationKeys {
30      private GnupgConfigurationKeys() {}
31  
32      static final String NAME = "gpg";
33  
34      static final String CONFIG_PROPS_PREFIX = ConfigurationProperties.PREFIX_GENERATOR + NAME + ".";
35  
36      /**
37       * Whether GnuPG signer is enabled.
38       *
39       * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
40       * @configurationType {@link Boolean}
41       * @configurationDefaultValue {@link #DEFAULT_ENABLED}
42       */
43      public static final String CONFIG_PROP_ENABLED = CONFIG_PROPS_PREFIX + "enabled";
44  
45      public static final boolean DEFAULT_ENABLED = false;
46  
47      /**
48       * The PGP Key fingerprint as hex string (40 characters long), optional. If not set, first secret key found will
49       * be used.
50       *
51       * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
52       * @configurationType {@link String}
53       */
54      public static final String CONFIG_PROP_KEY_FINGERPRINT = CONFIG_PROPS_PREFIX + "keyFingerprint";
55  
56      /**
57       * The path to the OpenPGP transferable secret key file. If relative, is resolved from local repository root.
58       *
59       * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
60       * @configurationType {@link String}
61       * @configurationDefaultValue {@link #DEFAULT_KEY_FILE_PATH}
62       */
63      public static final String CONFIG_PROP_KEY_FILE_PATH = CONFIG_PROPS_PREFIX + "keyFilePath";
64  
65      public static final String DEFAULT_KEY_FILE_PATH = "maven-signing-key.key";
66  
67      /**
68       * Whether GnuPG agent should be used.
69       *
70       * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
71       * @configurationType {@link java.lang.Boolean}
72       * @configurationDefaultValue {@link #DEFAULT_USE_AGENT}
73       */
74      public static final String CONFIG_PROP_USE_AGENT = CONFIG_PROPS_PREFIX + "useAgent";
75  
76      public static final boolean DEFAULT_USE_AGENT = true;
77  
78      /**
79       * The GnuPG agent socket(s) to try. Comma separated list of socket paths. If relative, will be resolved from
80       * user home directory.
81       *
82       * @configurationSource {@link RepositorySystemSession#getConfigProperties()}
83       * @configurationType {@link String}
84       * @configurationDefaultValue {@link #DEFAULT_AGENT_SOCKET_LOCATIONS}
85       */
86      public static final String CONFIG_PROP_AGENT_SOCKET_LOCATIONS = CONFIG_PROPS_PREFIX + "agentSocketLocations";
87  
88      public static final String DEFAULT_AGENT_SOCKET_LOCATIONS = ".gnupg/S.gpg-agent";
89  
90      /**
91       * Env variable name to pass in key pass.
92       */
93      public static final String RESOLVER_GPG_KEY_PASS = "RESOLVER_GPG_KEY_PASS";
94  
95      /**
96       * Env variable name to pass in key material.
97       */
98      public static final String RESOLVER_GPG_KEY = "RESOLVER_GPG_KEY";
99  
100     /**
101      * Env variable name to pass in key fingerprint (hex encoded, 40 characters long).
102      */
103     public static final String RESOLVER_GPG_KEY_FINGERPRINT = "RESOLVER_GPG_KEY_FINGERPRINT";
104 }