Path: blob/master/src/java.base/share/classes/sun/security/x509/DeltaCRLIndicatorExtension.java
41159 views
/*1* Copyright (c) 2005, 2020, 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.x509;2627import java.io.IOException;28import java.io.OutputStream;29import java.math.BigInteger;30import java.util.Enumeration;3132import sun.security.util.*;3334/**35* Represents the Delta CRL Indicator Extension.36*37* <p>38* The extension identifies a CRL as being a delta CRL.39* Delta CRLs contain updates to revocation information previously distributed,40* rather than all the information that would appear in a complete CRL.41* The extension contains a CRL number that identifies the CRL, complete for a42* given scope, that was used as the starting point in the generation of43* this delta CRL.44*45* <p>46* The extension is defined in Section 5.2.4 of47* <a href="http://tools.ietf.org/html/rfc5280">Internet X.509 PKI48* Certificate and Certificate Revocation List (CRL) Profile</a>.49*50* <p>51* Its ASN.1 definition is as follows:52* <pre>53* id-ce-deltaCRLIndicator OBJECT IDENTIFIER ::= { id-ce 27 }54*55* BaseCRLNumber ::= CRLNumber56* CRLNumber ::= INTEGER (0..MAX)57* </pre>58*59* @since 1.660*/61public class DeltaCRLIndicatorExtension extends CRLNumberExtension {6263/**64* Attribute name.65*/66public static final String NAME = "DeltaCRLIndicator";6768private static final String LABEL = "Base CRL Number";6970/**71* Creates a delta CRL indicator extension with the integer value .72* The criticality is set to true.73*74* @param crlNum the value to be set for the extension.75*/76public DeltaCRLIndicatorExtension(int crlNum) throws IOException {77super(PKIXExtensions.DeltaCRLIndicator_Id, true,78BigInteger.valueOf(crlNum), NAME, LABEL);79}8081/**82* Creates a delta CRL indictor extension with the BigInteger value .83* The criticality is set to true.84*85* @param crlNum the value to be set for the extension.86*/87public DeltaCRLIndicatorExtension(BigInteger crlNum) throws IOException {88super(PKIXExtensions.DeltaCRLIndicator_Id, true, crlNum, NAME, LABEL);89}9091/**92* Creates the extension from the passed DER encoded value of the same.93*94* @param critical true if the extension is to be treated as critical.95* @param value an array of DER encoded bytes of the actual value.96* @exception ClassCastException if value is not an array of bytes97* @exception IOException on decoding error.98*/99public DeltaCRLIndicatorExtension(Boolean critical, Object value)100throws IOException {101super(PKIXExtensions.DeltaCRLIndicator_Id, critical.booleanValue(),102value, NAME, LABEL);103}104105/**106* Writes the extension to the DerOutputStream.107*108* @param out the DerOutputStream to write the extension to.109* @exception IOException on encoding errors.110*/111public void encode(OutputStream out) throws IOException {112DerOutputStream tmp = new DerOutputStream();113super.encode(out, PKIXExtensions.DeltaCRLIndicator_Id, true);114}115}116117118