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