Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/security/tools/jarsigner/JarSignerParameters.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*/2425package sun.security.tools.jarsigner;2627import java.security.cert.Certificate;28import java.security.cert.X509Certificate;29import java.net.URI;30import java.util.zip.*;3132import com.sun.jarsigner.ContentSignerParameters;3334class JarSignerParameters implements ContentSignerParameters {3536private String[] args;37private URI tsa;38private X509Certificate tsaCertificate;39private byte[] signature;40private String signatureAlgorithm;41private X509Certificate[] signerCertificateChain;42private byte[] content;43private ZipFile source;44private String tSAPolicyID;45private String tSADigestAlg;4647/**48* Create a new object.49*/50JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate,51String tSAPolicyID, String tSADigestAlg,52byte[] signature, String signatureAlgorithm,53X509Certificate[] signerCertificateChain, byte[] content,54ZipFile source) {5556if (signature == null || signatureAlgorithm == null ||57signerCertificateChain == null || tSADigestAlg == null) {58throw new NullPointerException();59}60this.args = args;61this.tsa = tsa;62this.tsaCertificate = tsaCertificate;63this.tSAPolicyID = tSAPolicyID;64this.tSADigestAlg = tSADigestAlg;65this.signature = signature;66this.signatureAlgorithm = signatureAlgorithm;67this.signerCertificateChain = signerCertificateChain;68this.content = content;69this.source = source;70}7172/**73* Retrieves the command-line arguments.74*75* @return The command-line arguments. May be null.76*/77public String[] getCommandLine() {78return args;79}8081/**82* Retrieves the identifier for a Timestamping Authority (TSA).83*84* @return The TSA identifier. May be null.85*/86public URI getTimestampingAuthority() {87return tsa;88}8990/**91* Retrieves the certificate for a Timestamping Authority (TSA).92*93* @return The TSA certificate. May be null.94*/95public X509Certificate getTimestampingAuthorityCertificate() {96return tsaCertificate;97}9899public String getTSAPolicyID() {100return tSAPolicyID;101}102103public String getTSADigestAlg() {104return tSADigestAlg;105}106107/**108* Retrieves the signature.109*110* @return The non-null signature bytes.111*/112public byte[] getSignature() {113return signature;114}115116/**117* Retrieves the name of the signature algorithm.118*119* @return The non-null string name of the signature algorithm.120*/121public String getSignatureAlgorithm() {122return signatureAlgorithm;123}124125/**126* Retrieves the signer's X.509 certificate chain.127*128* @return The non-null array of X.509 public-key certificates.129*/130public X509Certificate[] getSignerCertificateChain() {131return signerCertificateChain;132}133134/**135* Retrieves the content that was signed.136*137* @return The content bytes. May be null.138*/139public byte[] getContent() {140return content;141}142143/**144* Retrieves the original source ZIP file before it was signed.145*146* @return The original ZIP file. May be null.147*/148public ZipFile getSource() {149return source;150}151}152153154