Frames | No Frames |
1: /* X509CRLEntry.java --- X.509 Certificate Revocation List Entry 2: Copyright (C) 1999 Free Software Foundation, Inc. 3: 4: This file is part of GNU Classpath. 5: 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. 10: 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. 15: 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., 51 Franklin Street, Fifth Floor, Boston, MA 19: 02110-1301 USA. 20: 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. 25: 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. */ 37: 38: 39: package java.security.cert; 40: 41: import java.math.BigInteger; 42: import java.util.Date; 43: 44: /** 45: Abstract class for entries in the CRL (Certificate Revocation 46: List). The ASN.1 definition for <I>revokedCertificates</I> is 47: 48: revokedCertificates SEQUENCE OF SEQUENCE { 49: userCertificate CertificateSerialNumber, 50: revocationDate Time, 51: crlEntryExtensions Extensions OPTIONAL 52: -- if present, shall be v2 53: } OPTIONAL, 54: 55: CertificateSerialNumber ::= INTEGER 56: 57: Time ::= CHOICE { 58: utcTime UTCTime, 59: generalTime GeneralizedTime } 60: 61: Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension 62: 63: Extension ::= SEQUENCE { 64: extnID OBJECT IDENTIFIER, 65: critical BOOLEAN DEFAULT FALSE, 66: extnValue OCTET STRING } 67: 68: For more information consult rfc2459. 69: 70: @author Mark Benvenuto 71: 72: @since JDK 1.2 73: */ 74: public abstract class X509CRLEntry implements X509Extension 75: { 76: 77: /** 78: Creates a new X509CRLEntry 79: */ 80: public X509CRLEntry() 81: {} 82: 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. 87: 88: @param other An Object to test for equality 89: 90: @return true if equal, false otherwise 91: */ 92: public boolean equals(Object other) 93: { 94: if( other instanceof X509CRLEntry ) { 95: try { 96: X509CRLEntry xe = (X509CRLEntry) other; 97: if( getEncoded().length != xe.getEncoded().length ) 98: return false; 99: 100: byte[] b1 = getEncoded(); 101: byte[] b2 = xe.getEncoded(); 102: 103: for( int i = 0; i < b1.length; i++ ) 104: if( b1[i] != b2[i] ) 105: return false; 106: 107: } catch( CRLException crle ) { 108: return false; 109: } 110: return true; 111: } 112: return false; 113: } 114: 115: /** 116: Returns a hash code for this X509CRLEntry in its encoded 117: form. 118: 119: @return A hash code of this class 120: */ 121: public int hashCode() 122: { 123: return super.hashCode(); 124: } 125: 126: /** 127: Gets the DER ASN.1 encoded format for this CRL Entry, 128: the inner SEQUENCE. 129: 130: @return byte array containg encoded form 131: 132: @throws CRLException if an error occurs 133: */ 134: public abstract byte[] getEncoded() throws CRLException; 135: 136: /** 137: Gets the serial number for <I>userCertificate</I> in 138: this X509CRLEntry. 139: 140: @return the serial number for this X509CRLEntry. 141: */ 142: public abstract BigInteger getSerialNumber(); 143: 144: 145: /** 146: Gets the revocation date in <I>revocationDate</I> for 147: this X509CRLEntry. 148: 149: @return the revocation date for this X509CRLEntry. 150: */ 151: public abstract Date getRevocationDate(); 152: 153: 154: /** 155: Checks if this X509CRLEntry has extensions. 156: 157: @return true if it has extensions, false otherwise 158: */ 159: public abstract boolean hasExtensions(); 160: 161: 162: /** 163: Returns a string that represents this X509CRLEntry. 164: 165: @return a string representing this X509CRLEntry. 166: */ 167: public abstract String toString(); 168: 169: }