src/java.base/share/classes/java/security/cert/X509CRL.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 45474 jdk/src/java.base/share/classes/java/security/cert/X509CRL.java@78b7a8c8fc06
child 50204 3195a713e24d
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
44476
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.security.cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.security.NoSuchAlgorithmException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.security.NoSuchProviderException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.security.InvalidKeyException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.security.SignatureException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.security.Principal;
13406
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
    33
import java.security.Provider;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.security.PublicKey;
44476
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
    35
import java.security.Signature;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.security.auth.x500.X500Principal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.math.BigInteger;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.util.Date;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.util.Set;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.util.Arrays;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import sun.security.x509.X509CRLImpl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * Abstract class for an X.509 Certificate Revocation List (CRL).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * A CRL is a time-stamped list identifying revoked certificates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * It is signed by a Certificate Authority (CA) and made freely
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * available in a public repository.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <p>Each revoked certificate is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * identified in a CRL by its certificate serial number. When a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * certificate-using system uses a certificate (e.g., for verifying a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * remote user's digital signature), that system not only checks the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * certificate signature and validity but also acquires a suitably-
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * recent CRL and checks that the certificate serial number is not on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * that CRL.  The meaning of "suitably-recent" may vary with local
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * policy, but it usually means the most recently-issued CRL.  A CA
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * issues a new CRL on a regular periodic basis (e.g., hourly, daily, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * weekly).  Entries are added to CRLs as revocations occur, and an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * entry may be removed when the certificate expiration date is reached.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * The X.509 v2 CRL format is described below in ASN.1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * CertificateList  ::=  SEQUENCE  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *     tbsCertList          TBSCertList,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 *     signatureAlgorithm   AlgorithmIdentifier,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *     signature            BIT STRING  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * More information can be found in
26967
c182469301ee 8037550: Update RFC references in javadoc to RFC 5280
juh
parents: 25859
diff changeset
    73
 * <a href="http://tools.ietf.org/html/rfc5280">RFC 5280: Internet X.509
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * Public Key Infrastructure Certificate and CRL Profile</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * <p>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
    76
 * The ASN.1 definition of {@code tbsCertList} is:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * TBSCertList  ::=  SEQUENCE  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *     version                 Version OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *                             -- if present, must be v2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *     signature               AlgorithmIdentifier,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *     issuer                  Name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *     thisUpdate              ChoiceOfTime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 *     nextUpdate              ChoiceOfTime OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 *     revokedCertificates     SEQUENCE OF SEQUENCE  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 *         userCertificate         CertificateSerialNumber,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 *         revocationDate          ChoiceOfTime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 *         crlEntryExtensions      Extensions OPTIONAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 *                                 -- if present, must be v2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 *         }  OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *     crlExtensions           [0]  EXPLICIT Extensions OPTIONAL
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *                                  -- if present, must be v2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * CRLs are instantiated using a certificate factory. The following is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * example of how to instantiate an X.509 CRL:
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
    98
 * <pre>{@code
10114
d35f0b7bda65 7054969: Null-check-in-finally pattern in java/security documentation
mullan
parents: 6114
diff changeset
    99
 * try (InputStream inStream = new FileInputStream("fileName-of-crl")) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 *     CertificateFactory cf = CertificateFactory.getInstance("X.509");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 *     X509CRL crl = (X509CRL)cf.generateCRL(inStream);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * }
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   103
 * }</pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * @author Hemma Prafullchandra
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 26967
diff changeset
   106
 * @since 1.2
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * @see CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * @see CertificateFactory
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * @see X509Extension
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
public abstract class X509CRL extends CRL implements X509Extension {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    private transient X500Principal issuerPrincipal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Constructor for X.509 CRLs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    protected X509CRL() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        super("X.509");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * Compares this CRL for equality with the given
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   127
     * object. If the {@code other} object is an
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   128
     * {@code instanceof} {@code X509CRL}, then
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * its encoded form is retrieved and compared with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * encoded form of this CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @param other the object to test for equality with this CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @return true iff the encoded forms of the two CRLs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * match, false otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    public boolean equals(Object other) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        if (this == other) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        if (!(other instanceof X509CRL)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            byte[] thisCRL = X509CRLImpl.getEncodedInternal(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            byte[] otherCRL = X509CRLImpl.getEncodedInternal((X509CRL)other);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
            return Arrays.equals(thisCRL, otherCRL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        } catch (CRLException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * Returns a hashcode value for this CRL from its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * encoded form.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @return the hashcode value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    public int hashCode() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
        int retval = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            byte[] crlData = X509CRLImpl.getEncodedInternal(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            for (int i = 1; i < crlData.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                 retval += crlData[i] * i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
            return retval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        } catch (CRLException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            return retval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Returns the ASN.1 DER-encoded form of this CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * @return the encoded form of this certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @exception CRLException if an encoding error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    public abstract byte[] getEncoded()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
        throws CRLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * Verifies that this CRL was signed using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * private key that corresponds to the given public key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @param key the PublicKey used to carry out the verification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @exception NoSuchAlgorithmException on unsupported signature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * algorithms.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @exception InvalidKeyException on incorrect key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * @exception NoSuchProviderException if there's no default provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * @exception SignatureException on signature errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @exception CRLException on encoding errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    public abstract void verify(PublicKey key)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        throws CRLException,  NoSuchAlgorithmException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        InvalidKeyException, NoSuchProviderException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        SignatureException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * Verifies that this CRL was signed using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * private key that corresponds to the given public key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * This method uses the signature verification engine
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * supplied by the given provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * @param key the PublicKey used to carry out the verification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @param sigProvider the name of the signature provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * @exception NoSuchAlgorithmException on unsupported signature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * algorithms.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @exception InvalidKeyException on incorrect key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * @exception NoSuchProviderException on incorrect provider.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * @exception SignatureException on signature errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * @exception CRLException on encoding errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    public abstract void verify(PublicKey key, String sigProvider)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        throws CRLException, NoSuchAlgorithmException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        InvalidKeyException, NoSuchProviderException,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        SignatureException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    /**
13406
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   222
     * Verifies that this CRL was signed using the
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   223
     * private key that corresponds to the given public key.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   224
     * This method uses the signature verification engine
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   225
     * supplied by the given provider. Note that the specified Provider object
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   226
     * does not have to be registered in the provider list.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   227
     *
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   228
     * This method was added to version 1.8 of the Java Platform Standard
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   229
     * Edition. In order to maintain backwards compatibility with existing
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   230
     * service providers, this method is not {@code abstract}
13406
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   231
     * and it provides a default implementation.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   232
     *
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   233
     * @param key the PublicKey used to carry out the verification.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   234
     * @param sigProvider the signature provider.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   235
     *
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   236
     * @exception NoSuchAlgorithmException on unsupported signature
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   237
     * algorithms.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   238
     * @exception InvalidKeyException on incorrect key.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   239
     * @exception SignatureException on signature errors.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   240
     * @exception CRLException on encoding errors.
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   241
     * @since 1.8
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   242
     */
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   243
    public void verify(PublicKey key, Provider sigProvider)
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   244
        throws CRLException, NoSuchAlgorithmException,
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   245
        InvalidKeyException, SignatureException {
44476
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   246
        Signature sig = (sigProvider == null)
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   247
            ? Signature.getInstance(getSigAlgName())
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   248
            : Signature.getInstance(getSigAlgName(), sigProvider);
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   249
        sig.initVerify(key);
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   250
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   251
        byte[] tbsCRL = getTBSCertList();
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   252
        sig.update(tbsCRL, 0, tbsCRL.length);
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   253
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   254
        if (sig.verify(getSignature()) == false) {
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   255
            throw new SignatureException("Signature does not match.");
e275cd2f9319 8175029: StackOverflowError in X509CRL and X509Certificate.verify(PublicKey, Provider)
mullan
parents: 26967
diff changeset
   256
        }
13406
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   257
    }
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   258
33d7bf574b42 7026347: Certificate and X509CRL should have verify(PublicKey key, Provider sigProvider)
mullan
parents: 10114
diff changeset
   259
    /**
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   260
     * Gets the {@code version} (version number) value from the CRL.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * version    Version OPTIONAL,
18592
80cdfecea074 8019539: Fix doclint errors in java.security and its subpackages
juh
parents: 18551
diff changeset
   264
     *             -- if present, must be v2
80cdfecea074 8019539: Fix doclint errors in java.security and its subpackages
juh
parents: 18551
diff changeset
   265
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     *             -- v3 does not apply to CRLs but appears for consistency
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     *             -- with definition of Version for certs
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     * @return the version number, i.e. 1 or 2.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    public abstract int getVersion();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * <strong>Denigrated</strong>, replaced by {@linkplain
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   277
     * #getIssuerX500Principal()}. This method returns the {@code issuer}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * as an implementation specific Principal object, which should not be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * relied upon by portable code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * <p>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   282
     * Gets the {@code issuer} (issuer distinguished name) value from
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * the CRL. The issuer name identifies the entity that signed (and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * issued) the CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * <p>The issuer name field contains an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * X.500 distinguished name (DN).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     * issuer    Name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * Name ::= CHOICE { RDNSequence }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * RelativeDistinguishedName ::=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     *     SET OF AttributeValueAssertion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * AttributeValueAssertion ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     *                               AttributeType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     *                               AttributeValue }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * AttributeType ::= OBJECT IDENTIFIER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * AttributeValue ::= ANY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * </pre>
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   303
     * The {@code Name} describes a hierarchical name composed of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * attributes,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * such as country name, and corresponding values, such as US.
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   306
     * The type of the {@code AttributeValue} component is determined by
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   307
     * the {@code AttributeType}; in general it will be a
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   308
     * {@code directoryString}. A {@code directoryString} is usually
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   309
     * one of {@code PrintableString},
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   310
     * {@code TeletexString} or {@code UniversalString}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * @return a Principal whose name is the issuer distinguished name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    public abstract Principal getIssuerDN();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * Returns the issuer (issuer distinguished name) value from the
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   318
     * CRL as an {@code X500Principal}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * It is recommended that subclasses override this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     *
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   322
     * @return an {@code X500Principal} representing the issuer
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     *          distinguished name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    public X500Principal getIssuerX500Principal() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
        if (issuerPrincipal == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
            issuerPrincipal = X509CRLImpl.getIssuerX500Principal(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
        return issuerPrincipal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    /**
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   334
     * Gets the {@code thisUpdate} date from the CRL.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * thisUpdate   ChoiceOfTime
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * ChoiceOfTime ::= CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *     utcTime        UTCTime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     *     generalTime    GeneralizedTime }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     *
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   343
     * @return the {@code thisUpdate} date from the CRL.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    public abstract Date getThisUpdate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    /**
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   348
     * Gets the {@code nextUpdate} date from the CRL.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     *
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   350
     * @return the {@code nextUpdate} date from the CRL, or null if
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * not present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    public abstract Date getNextUpdate();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * Gets the CRL entry, if any, with the given certificate serialNumber.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @param serialNumber the serial number of the certificate for which a CRL entry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * is to be looked up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * @return the entry with the given serial number, or null if no such entry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * exists in this CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * @see X509CRLEntry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    public abstract X509CRLEntry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        getRevokedCertificate(BigInteger serialNumber);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * Get the CRL entry, if any, for the given certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * <p>This method can be used to lookup CRL entries in indirect CRLs,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * that means CRLs that contain entries from issuers other than the CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * issuer. The default implementation will only return entries for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * certificates issued by the CRL issuer. Subclasses that wish to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * support indirect CRLs should override this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * @param certificate the certificate for which a CRL entry is to be looked
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     *   up
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * @return the entry for the given certificate, or null if no such entry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     *   exists in this CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @exception NullPointerException if certificate is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    public X509CRLEntry getRevokedCertificate(X509Certificate certificate) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        X500Principal certIssuer = certificate.getIssuerX500Principal();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
        X500Principal crlIssuer = getIssuerX500Principal();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        if (certIssuer.equals(crlIssuer) == false) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        return getRevokedCertificate(certificate.getSerialNumber());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     * Gets all the entries from this CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * This returns a Set of X509CRLEntry objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
     * @return all the entries or null if there are none present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * @see X509CRLEntry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    public abstract Set<? extends X509CRLEntry> getRevokedCertificates();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * Gets the DER-encoded CRL information, the
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   404
     * {@code tbsCertList} from this CRL.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * This can be used to verify the signature independently.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * @return the DER-encoded CRL information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * @exception CRLException if an encoding error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    public abstract byte[] getTBSCertList() throws CRLException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    /**
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   413
     * Gets the {@code signature} value (the raw signature bits) from
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * the CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * signature     BIT STRING
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * @return the signature.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    public abstract byte[] getSignature();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * Gets the signature algorithm name for the CRL
6114
9d463b9408ba 6870553: X509Certificate.getSigAlgName method description uses non-standard algorithm name as example
mullan
parents: 5506
diff changeset
   426
     * signature algorithm. An example is the string "SHA256withRSA".
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * <pre>
18592
80cdfecea074 8019539: Fix doclint errors in java.security and its subpackages
juh
parents: 18551
diff changeset
   429
     * signatureAlgorithm   AlgorithmIdentifier
80cdfecea074 8019539: Fix doclint errors in java.security and its subpackages
juh
parents: 18551
diff changeset
   430
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * AlgorithmIdentifier  ::=  SEQUENCE  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     *     algorithm               OBJECT IDENTIFIER,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     *     parameters              ANY DEFINED BY algorithm OPTIONAL  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     *                             -- contains a value of the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     *                             -- registered for use with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *                             -- algorithm object identifier value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     *
18551
882a3948c6e6 8017325: Cleanup of the javadoc <code> tag in java.security.cert
juh
parents: 14342
diff changeset
   439
     * <p>The algorithm name is determined from the {@code algorithm}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * OID string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * @return the signature algorithm name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
    public abstract String getSigAlgName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
     * Gets the signature algorithm OID string from the CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * An OID is represented by a set of nonnegative whole numbers separated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     * by periods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * For example, the string "1.2.840.10040.4.3" identifies the SHA-1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * with DSA signature algorithm defined in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * <a href="http://www.ietf.org/rfc/rfc3279.txt">RFC 3279: Algorithms and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * Identifiers for the Internet X.509 Public Key Infrastructure Certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * and CRL Profile</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * <p>See {@link #getSigAlgName() getSigAlgName} for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * relevant ASN.1 definitions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * @return the signature algorithm OID string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    public abstract String getSigAlgOID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * Gets the DER-encoded signature algorithm parameters from this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * CRL's signature algorithm. In most cases, the signature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * algorithm parameters are null; the parameters are usually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * supplied with the public key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * If access to individual parameter values is needed then use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * {@link java.security.AlgorithmParameters AlgorithmParameters}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * and instantiate with the name returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * {@link #getSigAlgName() getSigAlgName}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * <p>See {@link #getSigAlgName() getSigAlgName} for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * relevant ASN.1 definitions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * @return the DER-encoded signature algorithm parameters, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     *         null if no parameters are present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    public abstract byte[] getSigAlgParams();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
}