x509crlentry.java

来自「This is a resource based on j2me embedde」· Java 代码 · 共 159 行

JAVA
159
字号
/* * @(#)X509CRLEntry.java	1.18 06/10/10 * * Copyright  1990-2008 Sun Microsystems, Inc. All Rights Reserved.   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER   *    * This program is free software; you can redistribute it and/or   * modify it under the terms of the GNU General Public License version   * 2 only, as published by the Free Software Foundation.    *    * This program is distributed in the hope that it will be useful, but   * WITHOUT ANY WARRANTY; without even the implied warranty of   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   * General Public License version 2 for more details (a copy is   * included at /legal/license.txt).    *    * You should have received a copy of the GNU General Public License   * version 2 along with this work; if not, write to the Free Software   * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA   * 02110-1301 USA    *    * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa   * Clara, CA 95054 or visit www.sun.com if you need additional   * information or have any questions.  * */package java.security.cert;import java.math.BigInteger;import java.util.Date;import java.util.Set;/** * <p>Abstract class for a revoked certificate in a CRL (Certificate * Revocation List). * * The ASN.1 definition for <em>revokedCertificates</em> is: * <pre> * revokedCertificates    SEQUENCE OF SEQUENCE  { *     userCertificate    CertificateSerialNumber, *     revocationDate     ChoiceOfTime, *     crlEntryExtensions Extensions OPTIONAL *                        -- if present, must be v2 * }  OPTIONAL *<p> * CertificateSerialNumber  ::=  INTEGER *<p> * Extensions  ::=  SEQUENCE SIZE (1..MAX) OF Extension *<p> * Extension  ::=  SEQUENCE  { *     extnId        OBJECT IDENTIFIER, *     critical      BOOLEAN DEFAULT FALSE, *     extnValue     OCTET STRING *                   -- contains a DER encoding of a value *                   -- of the type registered for use with *                   -- the extnId object identifier value * } * </pre> * * @see X509CRL * @see X509Extension * * @author Hemma Prafullchandra * @version 1.12 00/02/02 */public abstract class X509CRLEntry implements X509Extension {    /**     * Compares this CRL entry for equality with the given     * object. If the <code>other</code> object is an     * <code>instanceof</code> <code>X509CRLEntry</code>, then     * its encoded form (the inner SEQUENCE) is retrieved and compared     * with the encoded form of this CRL entry.     *     * @param other the object to test for equality with this CRL entry.     * @return true iff the encoded forms of the two CRL entries     * match, false otherwise.     */    public boolean equals(Object other) {        if (this == other)            return true;        if (!(other instanceof X509CRLEntry))            return false;        try {            byte[] thisCRLEntry = this.getEncoded();            byte[] otherCRLEntry = ((X509CRLEntry)other).getEncoded();            if (thisCRLEntry.length != otherCRLEntry.length)                return false;            for (int i = 0; i < thisCRLEntry.length; i++)                 if (thisCRLEntry[i] != otherCRLEntry[i])                     return false;        } catch (CRLException ce) {            return false;        }        return true;    }    /**     * Returns a hashcode value for this CRL entry from its     * encoded form.     *     * @return the hashcode value.     */    public int hashCode() {        int     retval = 0;        try {            byte[] entryData = this.getEncoded();            for (int i = 1; i < entryData.length; i++)                 retval += entryData[i] * i;        } catch (CRLException ce) {            return(retval);        }        return(retval);    }    /**     * Returns the ASN.1 DER-encoded form of this CRL Entry,     * that is the inner SEQUENCE.     *     * @return the encoded form of this certificate     * @exception CRLException if an encoding error occurs.     */    public abstract byte[] getEncoded() throws CRLException;    /**     * Gets the serial number from this X509CRLEntry,     * the <em>userCertificate</em>.     *     * @return the serial number.     */    public abstract BigInteger getSerialNumber();    /**     * Gets the revocation date from this X509CRLEntry,     * the <em>revocationDate</em>.     *     * @return the revocation date.     */    public abstract Date getRevocationDate();    /**     * Returns true if this CRL entry has extensions.     *     * @return true if this entry has extensions, false otherwise.     */    public abstract boolean hasExtensions();    /**     * Returns a string representation of this CRL entry.     *     * @return a string representation of this CRL entry.     */    public abstract String toString();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?