Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/provider/certpath/PKIXTimestampParameters.java
38923 views
/*1* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526package sun.security.provider.certpath;2728import java.security.InvalidAlgorithmParameterException;29import java.security.Timestamp;30import java.security.cert.CertSelector;31import java.security.cert.CertStore;32import java.security.cert.PKIXBuilderParameters;33import java.security.cert.PKIXCertPathChecker;34import java.security.cert.TrustAnchor;35import java.util.Date;36import java.util.List;37import java.util.Set;3839/**40* This class is a wrapper for PKIXBuilderParameters so that a Timestamp object41* can be passed alone when PKIXCertPath is checking signed jar files.42*/4344public class PKIXTimestampParameters extends PKIXBuilderParameters {4546private final PKIXBuilderParameters p;47private Timestamp jarTimestamp;4849public PKIXTimestampParameters(PKIXBuilderParameters params,50Timestamp timestamp) throws InvalidAlgorithmParameterException {51super(params.getTrustAnchors(), null);52p = params;53jarTimestamp = timestamp;54}5556public Timestamp getTimestamp() {57return jarTimestamp;58}59public void setTimestamp(Timestamp t) {60jarTimestamp = t;61}6263@Override64public void setDate(Date d) {65p.setDate(d);66}6768@Override69public void addCertPathChecker(PKIXCertPathChecker c) {70p.addCertPathChecker(c);71}7273@Override74public void setMaxPathLength(int maxPathLength) {75p.setMaxPathLength(maxPathLength);76}7778@Override79public int getMaxPathLength() {80return p.getMaxPathLength();81}8283@Override84public String toString() {85return p.toString();86}8788@Override89public Set<TrustAnchor> getTrustAnchors() {90return p.getTrustAnchors();91}9293@Override94public void setTrustAnchors(Set<TrustAnchor> trustAnchors)95throws InvalidAlgorithmParameterException {96// To avoid problems with PKIXBuilderParameter's constructors97if (p == null) {98return;99}100p.setTrustAnchors(trustAnchors);101}102103@Override104public Set<String> getInitialPolicies() {105return p.getInitialPolicies();106}107108@Override109public void setInitialPolicies(Set<String> initialPolicies) {110p.setInitialPolicies(initialPolicies);111}112113@Override114public void setCertStores(List<CertStore> stores) {115p.setCertStores(stores);116}117118@Override119public void addCertStore(CertStore store) {120p.addCertStore(store);121}122123@Override124public List<CertStore> getCertStores() {125return p.getCertStores();126}127128@Override129public void setRevocationEnabled(boolean val) {130p.setRevocationEnabled(val);131}132133@Override134public boolean isRevocationEnabled() {135return p.isRevocationEnabled();136}137138@Override139public void setExplicitPolicyRequired(boolean val) {140p.setExplicitPolicyRequired(val);141}142143@Override144public boolean isExplicitPolicyRequired() {145return p.isExplicitPolicyRequired();146}147148@Override149public void setPolicyMappingInhibited(boolean val) {150p.setPolicyMappingInhibited(val);151}152153@Override154public boolean isPolicyMappingInhibited() {155return p.isPolicyMappingInhibited();156}157158@Override159public void setAnyPolicyInhibited(boolean val) {160p.setAnyPolicyInhibited(val);161}162163@Override164public boolean isAnyPolicyInhibited() {165return p.isAnyPolicyInhibited();166}167168@Override169public void setPolicyQualifiersRejected(boolean qualifiersRejected) {170p.setPolicyQualifiersRejected(qualifiersRejected);171}172173@Override174public boolean getPolicyQualifiersRejected() {175return p.getPolicyQualifiersRejected();176}177178@Override179public Date getDate() {180return p.getDate();181}182183@Override184public void setCertPathCheckers(List<PKIXCertPathChecker> checkers) {185p.setCertPathCheckers(checkers);186}187188@Override189public List<PKIXCertPathChecker> getCertPathCheckers() {190return p.getCertPathCheckers();191}192193@Override194public String getSigProvider() {195return p.getSigProvider();196}197198@Override199public void setSigProvider(String sigProvider) {200p.setSigProvider(sigProvider);201}202203@Override204public CertSelector getTargetCertConstraints() {205return p.getTargetCertConstraints();206}207208@Override209public void setTargetCertConstraints(CertSelector selector) {210// To avoid problems with PKIXBuilderParameter's constructors211if (p == null) {212return;213}214p.setTargetCertConstraints(selector);215}216217}218219220