Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/java.base/share/classes/sun/security/provider/certpath/PKIXExtendedParameters.java
41161 views
1
/*
2
* Copyright (c) 2016, 2017, 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
27
package sun.security.provider.certpath;
28
29
import java.security.InvalidAlgorithmParameterException;
30
import java.security.Timestamp;
31
import java.security.cert.CertSelector;
32
import java.security.cert.CertStore;
33
import java.security.cert.PKIXBuilderParameters;
34
import java.security.cert.PKIXCertPathChecker;
35
import java.security.cert.TrustAnchor;
36
import java.util.Date;
37
import java.util.List;
38
import java.util.Set;
39
40
/**
41
* This class is a wrapper for PKIXBuilderParameters so that a Timestamp object
42
* and a string for the variant type, can be passed when doing certpath
43
* checking.
44
*/
45
46
public class PKIXExtendedParameters extends PKIXBuilderParameters {
47
48
private final PKIXBuilderParameters p;
49
private Timestamp jarTimestamp;
50
private final String variant;
51
52
public PKIXExtendedParameters(PKIXBuilderParameters params,
53
Timestamp timestamp, String variant)
54
throws InvalidAlgorithmParameterException {
55
super(params.getTrustAnchors(), null);
56
p = params;
57
jarTimestamp = timestamp;
58
this.variant = variant;
59
}
60
61
public Timestamp getTimestamp() {
62
return jarTimestamp;
63
}
64
public void setTimestamp(Timestamp t) {
65
jarTimestamp = t;
66
}
67
68
public String getVariant() {
69
return variant;
70
}
71
72
@Override
73
public void setDate(Date d) {
74
p.setDate(d);
75
}
76
77
@Override
78
public void addCertPathChecker(PKIXCertPathChecker c) {
79
p.addCertPathChecker(c);
80
}
81
82
@Override
83
public void setMaxPathLength(int maxPathLength) {
84
p.setMaxPathLength(maxPathLength);
85
}
86
87
@Override
88
public int getMaxPathLength() {
89
return p.getMaxPathLength();
90
}
91
92
@Override
93
public String toString() {
94
return p.toString();
95
}
96
97
@Override
98
public Set<TrustAnchor> getTrustAnchors() {
99
return p.getTrustAnchors();
100
}
101
102
@Override
103
public void setTrustAnchors(Set<TrustAnchor> trustAnchors)
104
throws InvalidAlgorithmParameterException {
105
// To avoid problems with PKIXBuilderParameter's constructors
106
if (p == null) {
107
return;
108
}
109
p.setTrustAnchors(trustAnchors);
110
}
111
112
@Override
113
public Set<String> getInitialPolicies() {
114
return p.getInitialPolicies();
115
}
116
117
@Override
118
public void setInitialPolicies(Set<String> initialPolicies) {
119
p.setInitialPolicies(initialPolicies);
120
}
121
122
@Override
123
public void setCertStores(List<CertStore> stores) {
124
p.setCertStores(stores);
125
}
126
127
@Override
128
public void addCertStore(CertStore store) {
129
p.addCertStore(store);
130
}
131
132
@Override
133
public List<CertStore> getCertStores() {
134
return p.getCertStores();
135
}
136
137
@Override
138
public void setRevocationEnabled(boolean val) {
139
p.setRevocationEnabled(val);
140
}
141
142
@Override
143
public boolean isRevocationEnabled() {
144
return p.isRevocationEnabled();
145
}
146
147
@Override
148
public void setExplicitPolicyRequired(boolean val) {
149
p.setExplicitPolicyRequired(val);
150
}
151
152
@Override
153
public boolean isExplicitPolicyRequired() {
154
return p.isExplicitPolicyRequired();
155
}
156
157
@Override
158
public void setPolicyMappingInhibited(boolean val) {
159
p.setPolicyMappingInhibited(val);
160
}
161
162
@Override
163
public boolean isPolicyMappingInhibited() {
164
return p.isPolicyMappingInhibited();
165
}
166
167
@Override
168
public void setAnyPolicyInhibited(boolean val) {
169
p.setAnyPolicyInhibited(val);
170
}
171
172
@Override
173
public boolean isAnyPolicyInhibited() {
174
return p.isAnyPolicyInhibited();
175
}
176
177
@Override
178
public void setPolicyQualifiersRejected(boolean qualifiersRejected) {
179
p.setPolicyQualifiersRejected(qualifiersRejected);
180
}
181
182
@Override
183
public boolean getPolicyQualifiersRejected() {
184
return p.getPolicyQualifiersRejected();
185
}
186
187
@Override
188
public Date getDate() {
189
return p.getDate();
190
}
191
192
@Override
193
public void setCertPathCheckers(List<PKIXCertPathChecker> checkers) {
194
p.setCertPathCheckers(checkers);
195
}
196
197
@Override
198
public List<PKIXCertPathChecker> getCertPathCheckers() {
199
return p.getCertPathCheckers();
200
}
201
202
@Override
203
public String getSigProvider() {
204
return p.getSigProvider();
205
}
206
207
@Override
208
public void setSigProvider(String sigProvider) {
209
p.setSigProvider(sigProvider);
210
}
211
212
@Override
213
public CertSelector getTargetCertConstraints() {
214
return p.getTargetCertConstraints();
215
}
216
217
@Override
218
public void setTargetCertConstraints(CertSelector selector) {
219
// To avoid problems with PKIXBuilderParameter's constructors
220
if (p == null) {
221
return;
222
}
223
p.setTargetCertConstraints(selector);
224
}
225
226
}
227
228