Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/tools/jarsigner/JarSignerParameters.java
38923 views
1
/*
2
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.security.tools.jarsigner;
27
28
import java.security.cert.Certificate;
29
import java.security.cert.X509Certificate;
30
import java.net.URI;
31
import java.util.zip.*;
32
33
import com.sun.jarsigner.ContentSignerParameters;
34
35
class JarSignerParameters implements ContentSignerParameters {
36
37
private String[] args;
38
private URI tsa;
39
private X509Certificate tsaCertificate;
40
private byte[] signature;
41
private String signatureAlgorithm;
42
private X509Certificate[] signerCertificateChain;
43
private byte[] content;
44
private ZipFile source;
45
private String tSAPolicyID;
46
private String tSADigestAlg;
47
48
/**
49
* Create a new object.
50
*/
51
JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate,
52
String tSAPolicyID, String tSADigestAlg,
53
byte[] signature, String signatureAlgorithm,
54
X509Certificate[] signerCertificateChain, byte[] content,
55
ZipFile source) {
56
57
if (signature == null || signatureAlgorithm == null ||
58
signerCertificateChain == null || tSADigestAlg == null) {
59
throw new NullPointerException();
60
}
61
this.args = args;
62
this.tsa = tsa;
63
this.tsaCertificate = tsaCertificate;
64
this.tSAPolicyID = tSAPolicyID;
65
this.tSADigestAlg = tSADigestAlg;
66
this.signature = signature;
67
this.signatureAlgorithm = signatureAlgorithm;
68
this.signerCertificateChain = signerCertificateChain;
69
this.content = content;
70
this.source = source;
71
}
72
73
/**
74
* Retrieves the command-line arguments.
75
*
76
* @return The command-line arguments. May be null.
77
*/
78
public String[] getCommandLine() {
79
return args;
80
}
81
82
/**
83
* Retrieves the identifier for a Timestamping Authority (TSA).
84
*
85
* @return The TSA identifier. May be null.
86
*/
87
public URI getTimestampingAuthority() {
88
return tsa;
89
}
90
91
/**
92
* Retrieves the certificate for a Timestamping Authority (TSA).
93
*
94
* @return The TSA certificate. May be null.
95
*/
96
public X509Certificate getTimestampingAuthorityCertificate() {
97
return tsaCertificate;
98
}
99
100
public String getTSAPolicyID() {
101
return tSAPolicyID;
102
}
103
104
public String getTSADigestAlg() {
105
return tSADigestAlg;
106
}
107
108
/**
109
* Retrieves the signature.
110
*
111
* @return The non-null signature bytes.
112
*/
113
public byte[] getSignature() {
114
return signature;
115
}
116
117
/**
118
* Retrieves the name of the signature algorithm.
119
*
120
* @return The non-null string name of the signature algorithm.
121
*/
122
public String getSignatureAlgorithm() {
123
return signatureAlgorithm;
124
}
125
126
/**
127
* Retrieves the signer's X.509 certificate chain.
128
*
129
* @return The non-null array of X.509 public-key certificates.
130
*/
131
public X509Certificate[] getSignerCertificateChain() {
132
return signerCertificateChain;
133
}
134
135
/**
136
* Retrieves the content that was signed.
137
*
138
* @return The content bytes. May be null.
139
*/
140
public byte[] getContent() {
141
return content;
142
}
143
144
/**
145
* Retrieves the original source ZIP file before it was signed.
146
*
147
* @return The original ZIP file. May be null.
148
*/
149
public ZipFile getSource() {
150
return source;
151
}
152
}
153
154