Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / libjava / java / security / cert / X509CRLEntry.java
blob99ff615cb4785691c7273863dd1127145654d5df
1 /* X509CRLEntry.java --- X.509 Certificate Revocation List Entry
2 Copyright (C) 1999 Free Software Foundation, Inc.
4 This file is part of GNU Classpath.
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING. If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library. Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 independent module, the terms and conditions of the license of that
32 module. An independent module is a module which is not derived from
33 or based on this library. If you modify this library, you may extend
34 this exception to your version of the library, but you are not
35 obligated to do so. If you do not wish to do so, delete this
36 exception statement from your version. */
39 package java.security.cert;
41 import java.math.BigInteger;
42 import java.util.Date;
44 /**
45 Abstract class for entries in the CRL (Certificate Revocation
46 List). The ASN.1 definition for <I>revokedCertificates</I> is
48 revokedCertificates SEQUENCE OF SEQUENCE {
49 userCertificate CertificateSerialNumber,
50 revocationDate Time,
51 crlEntryExtensions Extensions OPTIONAL
52 -- if present, shall be v2
53 } OPTIONAL,
55 CertificateSerialNumber ::= INTEGER
57 Time ::= CHOICE {
58 utcTime UTCTime,
59 generalTime GeneralizedTime }
61 Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
63 Extension ::= SEQUENCE {
64 extnID OBJECT IDENTIFIER,
65 critical BOOLEAN DEFAULT FALSE,
66 extnValue OCTET STRING }
68 For more information consult rfc2459.
70 @author Mark Benvenuto
72 @since JDK 1.2
74 public abstract class X509CRLEntry implements X509Extension
77 /**
78 Creates a new X509CRLEntry
80 public X509CRLEntry()
83 /**
84 Compares this X509CRLEntry to other. It checks if the
85 object if instanceOf X509CRLEntry and then checks if
86 the encoded form( the inner SEQUENCE) matches.
88 @param other An Object to test for equality
90 @return true if equal, false otherwise
92 public boolean equals(Object other)
94 if( other instanceof X509CRLEntry ) {
95 try {
96 X509CRLEntry xe = (X509CRLEntry) other;
97 if( getEncoded().length != xe.getEncoded().length )
98 return false;
100 byte[] b1 = getEncoded();
101 byte[] b2 = xe.getEncoded();
103 for( int i = 0; i < b1.length; i++ )
104 if( b1[i] != b2[i] )
105 return false;
107 } catch( CRLException crle ) {
108 return false;
110 return true;
112 return false;
116 Returns a hash code for this X509CRLEntry in its encoded
117 form.
119 @return A hash code of this class
121 public int hashCode()
123 return super.hashCode();
127 Gets the DER ASN.1 encoded format for this CRL Entry,
128 the inner SEQUENCE.
130 @return byte array containg encoded form
132 @throws CRLException if an error occurs
134 public abstract byte[] getEncoded() throws CRLException;
137 Gets the serial number for <I>userCertificate</I> in
138 this X509CRLEntry.
140 @return the serial number for this X509CRLEntry.
142 public abstract BigInteger getSerialNumber();
146 Gets the revocation date in <I>revocationDate</I> for
147 this X509CRLEntry.
149 @return the revocation date for this X509CRLEntry.
151 public abstract Date getRevocationDate();
155 Checks if this X509CRLEntry has extensions.
157 @return true if it has extensions, false otherwise
159 public abstract boolean hasExtensions();
163 Returns a string that represents this X509CRLEntry.
165 @return a string representing this X509CRLEntry.
167 public abstract String toString();