1
2
3
4
5
6
7
8
9
10 package org.eclipse.jgit.lib;
11
12
13
14
15
16
17 public class GpgConfig {
18
19
20
21
22 public enum GpgFormat implements Config.ConfigEnum {
23
24
25 OPENPGP("openpgp"),
26
27 X509("x509");
28
29 private final String configValue;
30
31 private GpgFormat(String configValue) {
32 this.configValue = configValue;
33 }
34
35 @Override
36 public boolean matchConfigValue(String s) {
37 return configValue.equals(s);
38 }
39
40 @Override
41 public String toConfigValue() {
42 return configValue;
43 }
44 }
45
46 private final Config config;
47
48
49
50
51
52
53
54 public GpgConfig(Config config) {
55 this.config = config;
56 }
57
58
59
60
61
62
63 public GpgFormat getKeyFormat() {
64 return config.getEnum(GpgFormat.values(),
65 ConfigConstants.CONFIG_GPG_SECTION, null,
66 ConfigConstants.CONFIG_KEY_FORMAT, GpgFormat.OPENPGP);
67 }
68
69
70
71
72
73
74 public String getSigningKey() {
75 return config.getString(ConfigConstants.CONFIG_USER_SECTION, null,
76 ConfigConstants.CONFIG_KEY_SIGNINGKEY);
77 }
78
79
80
81
82
83
84 public boolean isSignCommits() {
85 return config.getBoolean(ConfigConstants.CONFIG_COMMIT_SECTION,
86 ConfigConstants.CONFIG_KEY_GPGSIGN, false);
87 }
88 }