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.apache.maven.shared.jarsigner;
20  
21  import java.io.File;
22  
23  /**
24   * Specifies the parameters used to control a jar signer sign operation invocation.
25   *
26   * @author Tony Chemit
27   * @since 1.0
28   */
29  public class JarSignerSignRequest extends AbstractJarSignerRequest {
30  
31      /**
32       * See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
33       */
34      private String keypass;
35  
36      /**
37       * See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
38       */
39      private String sigfile;
40  
41      /**
42       * The {@code -tsa} parameter, the URL to the Time Stamping Authority (TSA) server.
43       * See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
44       */
45      private String tsaLocation;
46  
47      /**
48       * The {@code -tsacert} parameter. Alias for a certificate in the active keystore. From the certificate the X509v3
49       * extension "Subject Information Access" field is examined to find a TSA server URL.
50       * See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
51       */
52      private String tsaAlias;
53  
54      /**
55       * The {@code -tsapolicyid} parameter, an OID to send to the TSA server to identify the policy ID the server should
56       * use. See
57       * <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
58       *
59       * @since 3.1.0
60       */
61      private String tsapolicyid;
62  
63      /**
64       * The {@code -tsadigestalg} parameter, the message digest algorithm for TSA server to use. Only available in Java
65       * 11 and later. See
66       * <a href="https://docs.oracle.com/en/java/javase/11/tools/jarsigner.html">options</a>.
67       *
68       * @since 3.1.0
69       */
70      private String tsadigestalg;
71  
72      /**
73       * See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
74       */
75      protected File signedjar;
76  
77      /**
78       * Location of the extra certchain file to be used during signing.
79       *
80       * See <a href="https://docs.oracle.com/javase/8/docs/technotes/tools/windows/jarsigner.html#CCHIFIAD">options</a>.
81       * @since 3.0.0
82       */
83      protected File certchain;
84  
85      public String getKeypass() {
86          return keypass;
87      }
88  
89      public String getSigfile() {
90          return sigfile;
91      }
92  
93      public String getTsaLocation() {
94          return tsaLocation;
95      }
96  
97      public String getTsaAlias() {
98          return tsaAlias;
99      }
100 
101     public String getTsapolicyid() {
102         return tsapolicyid;
103     }
104 
105     public String getTsadigestalg() {
106         return tsadigestalg;
107     }
108 
109     public void setKeypass(String keypass) {
110         this.keypass = keypass;
111     }
112 
113     public void setSigfile(String sigfile) {
114         this.sigfile = sigfile;
115     }
116 
117     public void setTsaLocation(String tsaLocation) {
118         this.tsaLocation = tsaLocation;
119     }
120 
121     public void setTsaAlias(String tsaAlias) {
122         this.tsaAlias = tsaAlias;
123     }
124 
125     public void setTsapolicyid(String tsapolicyid) {
126         this.tsapolicyid = tsapolicyid;
127     }
128 
129     public void setTsadigestalg(String tsadigestalg) {
130         this.tsadigestalg = tsadigestalg;
131     }
132 
133     public File getSignedjar() {
134         return signedjar;
135     }
136 
137     public void setSignedjar(File signedjar) {
138         this.signedjar = signedjar;
139     }
140 
141     /**
142      * Sets certchain to be used.
143      *
144      * @param certchain Cert Chain file path or {@code null} to remove the option
145      * @since 3.0.0
146      */
147     public void setCertchain(File certchain) {
148         this.certchain = certchain;
149     }
150 
151     /**
152      * Get certificate chain.
153      * @return Path to the certificate chain file or {@code null} if undefined
154      */
155     public File getCertchain() {
156         return certchain;
157     }
158 }