1 /*
2  * Copyright (c) 2005, 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.x509;
27 
28 import java.io.IOException;
29 import java.io.OutputStream;
30 import java.math.BigInteger;
31 import java.util.Enumeration;
32 import java.util.List;
33 
34 import sun.security.util.*;
35 
36 /**
37  * Represents the Freshest CRL Extension.
38  *
39  * <p>
40  * The extension identifies how delta CRL information for a
41  * complete CRL is obtained.
42  *
43  * <p>
44  * The extension is defined in Section 5.2.6 of
45  * <a href="http://www.ietf.org/rfc/rfc3280.txt">Internet X.509 PKI Certific
46 ate and Certificate Revocation List (CRL) Profile</a>.
47  *
48  * <p>
49  * Its ASN.1 definition is as follows:
50  * <pre>
51  *     id-ce-freshestCRL OBJECT IDENTIFIER ::=  { id-ce 46 }
52  *
53  *     FreshestCRL ::= CRLDistributionPoints
54  * </pre>
55  *
56  * @since 1.6
57  */
58 public class FreshestCRLExtension extends CRLDistributionPointsExtension {
59 
60     /**
61      * Attribute name.
62      */
63     public static final String NAME = "FreshestCRL";
64 
65     /**
66      * Creates a freshest CRL extension.
67      * The criticality is set to false.
68      *
69      * @param distributionPoints the list of delta CRL distribution points.
70      */
FreshestCRLExtension(List<DistributionPoint> distributionPoints)71     public FreshestCRLExtension(List<DistributionPoint> distributionPoints)
72         throws IOException {
73 
74         super(PKIXExtensions.FreshestCRL_Id, false, distributionPoints, NAME);
75     }
76 
77     /**
78      * Creates the extension from the passed DER encoded value of the same.
79      *
80      * @param critical true if the extension is to be treated as critical.
81      * @param value an array of DER encoded bytes of the actual value.
82      * @exception IOException on decoding error.
83      */
FreshestCRLExtension(Boolean critical, Object value)84     public FreshestCRLExtension(Boolean critical, Object value)
85     throws IOException {
86         super(PKIXExtensions.FreshestCRL_Id, critical.booleanValue(), value,
87             NAME);
88     }
89 
90     /**
91      * Writes the extension to the DerOutputStream.
92      *
93      * @param out the DerOutputStream to write the extension to.
94      * @exception IOException on encoding errors.
95      */
encode(OutputStream out)96     public void encode(OutputStream out) throws IOException {
97         super.encode(out, PKIXExtensions.FreshestCRL_Id, false);
98     }
99 }
100