jdk/src/java.base/share/classes/javax/security/cert/X509Certificate.java
author darcy
Thu, 23 Apr 2015 18:51:18 -0700
changeset 30033 b9c86c17164a
parent 29377 d3f457ce9c48
child 39562 672b948cb355
permissions -rw-r--r--
8078468: Update security libraries to use diamond with anonymous classes Reviewed-by: weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
29377
d3f457ce9c48 8073430: Deprecate security APIs that have been superseded
juh
parents: 25859
diff changeset
     2
 * Copyright (c) 1997, 2015, 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: 715
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: 715
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: 715
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package javax.security.cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.lang.Class;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.lang.reflect.Constructor;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.lang.reflect.InvocationTargetException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.security.Security;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.math.BigInteger;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.security.Principal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.security.PrivilegedAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.security.PublicKey;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.util.BitSet;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.util.Date;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * Abstract class for X.509 v1 certificates. This provides a standard
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * way to access all the version 1 attributes of an X.509 certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * Attributes that are specific to X.509 v2 or v3 are not available
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * through this interface. Future API evolution will provide full access to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * complete X.509 v3 attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * The basic X.509 format was defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * ISO/IEC and ANSI X9 and is described below in ASN.1:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * Certificate  ::=  SEQUENCE  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *     tbsCertificate       TBSCertificate,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *     signatureAlgorithm   AlgorithmIdentifier,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *     signature            BIT STRING  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * These certificates are widely used to support authentication and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * other functionality in Internet security systems. Common applications
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * include Privacy Enhanced Mail (PEM), Transport Layer Security (SSL),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * code signing for trusted software distribution, and Secure Electronic
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * Transactions (SET).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * These certificates are managed and vouched for by <em>Certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * Authorities</em> (CAs). CAs are services which create certificates by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * placing data in the X.509 standard format and then digitally signing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * that data. CAs act as trusted third parties, making introductions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * between principals who have no direct knowledge of each other.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * CA certificates are either signed by themselves, or by some other
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * CA such as a "root" CA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * <p>
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
    73
 * The ASN.1 definition of {@code tbsCertificate} is:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * TBSCertificate  ::=  SEQUENCE  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *     version         [0]  EXPLICIT Version DEFAULT v1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 *     serialNumber         CertificateSerialNumber,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 *     signature            AlgorithmIdentifier,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *     issuer               Name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *     validity             Validity,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *     subject              Name,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 *     subjectPublicKeyInfo SubjectPublicKeyInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 *     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * Here is sample code to instantiate an X.509 certificate:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * InputStream inStream = new FileInputStream("fileName-of-cert");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * X509Certificate cert = X509Certificate.getInstance(inStream);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * inStream.close();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * OR
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * byte[] certData = &lt;certificate read from a file, say&gt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * X509Certificate cert = X509Certificate.getInstance(certData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * In either case, the code that instantiates an X.509 certificate
14775
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
    99
 * consults the value of the {@code cert.provider.x509v1} security property
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
   100
 * to locate the actual implementation or instantiates a default implementation.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * <p>
14775
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
   102
 * The {@code cert.provider.x509v1} property is set to a default
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
   103
 * implementation for X.509 such as:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * cert.provider.x509v1=com.sun.security.cert.internal.x509.X509V1CertImpl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * <p>
14775
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
   108
 * The value of this {@code cert.provider.x509v1} property has to be
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
   109
 * changed to instantiate another implementation. If this security
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * property is not set, a default implementation will be used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * Currently, due to possible security restrictions on access to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * Security properties, this value is looked up and cached at class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * initialization time and will fallback on a default implementation if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * the Security property is not accessible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 *
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   116
 * <p><em>Note: The classes in the package {@code javax.security.cert}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * exist for compatibility with earlier versions of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * Java Secure Sockets Extension (JSSE). New applications should instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * use the standard Java SE certificate classes located in
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   120
 * {@code java.security.cert}.</em></p>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * @author Hemma Prafullchandra
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * @since 1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * @see Certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * @see java.security.cert.X509Extension
14775
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
   126
 * @see java.security.Security security properties
29377
d3f457ce9c48 8073430: Deprecate security APIs that have been superseded
juh
parents: 25859
diff changeset
   127
 * @deprecated Use the classes in {@code java.security.cert} instead.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 */
29377
d3f457ce9c48 8073430: Deprecate security APIs that have been superseded
juh
parents: 25859
diff changeset
   129
@Deprecated
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
public abstract class X509Certificate extends Certificate {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * Constant to lookup in the Security properties file.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * In the Security properties file the default implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * for X.509 v3 is given as:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * cert.provider.x509v1=com.sun.security.cert.internal.x509.X509V1CertImpl
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    private static final String X509_PROVIDER = "cert.provider.x509v1";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    private static String X509Provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
        X509Provider = AccessController.doPrivileged(
30033
b9c86c17164a 8078468: Update security libraries to use diamond with anonymous classes
darcy
parents: 29377
diff changeset
   145
            new PrivilegedAction<>() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                public String run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                    return Security.getProperty(X509_PROVIDER);
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
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Instantiates an X509Certificate object, and initializes it with
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   155
     * the data read from the input stream {@code inStream}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * The implementation (X509Certificate is an abstract class) is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * provided by the class specified as the value of the
14775
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
   158
     * {@code cert.provider.x509v1} security property.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * <p>Note: Only one DER-encoded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * certificate is expected to be in the input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * Also, all X509Certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * subclasses must provide a constructor of the form:
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   164
     * <pre>{@code
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   165
     * public <subClass>(InputStream inStream) ...
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   166
     * }</pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @param inStream an input stream with the data to be read to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     *        initialize the certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * @return an X509Certificate object initialized with the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     *         from the input stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * @exception CertificateException if a class initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     *            or certificate parsing error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    public static final X509Certificate getInstance(InputStream inStream)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    throws CertificateException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        return getInst((Object)inStream);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     * Instantiates an X509Certificate object, and initializes it with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * the specified byte array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * The implementation (X509Certificate is an abstract class) is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * provided by the class specified as the value of the
14775
2ed01c760aea 8004064: Downgrade normative references to ${java.home}/lib/security/java.security
mullan
parents: 14342
diff changeset
   185
     * {@code cert.provider.x509v1} security property.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * <p>Note: All X509Certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * subclasses must provide a constructor of the form:
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   189
     * <pre>{@code
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   190
     * public <subClass>(InputStream inStream) ...
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   191
     * }</pre>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * @param certData a byte array containing the DER-encoded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     *        certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * @return an X509Certificate object initialized with the data
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   196
     *         from {@code certData}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @exception CertificateException if a class initialization
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     *            or certificate parsing error occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    public static final X509Certificate getInstance(byte[] certData)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    throws CertificateException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        return getInst((Object)certData);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    private static final X509Certificate getInst(Object value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    throws CertificateException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
         * This turns out not to work for now. To run under JDK1.2 we would
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
         * need to call beginPrivileged() but we can't do that and run
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
         * under JDK1.1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        String className = X509Provider;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        if (className == null || className.length() == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
            // shouldn't happen, but assume corrupted properties file
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
            // provide access to sun implementation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            className = "com.sun.security.cert.internal.x509.X509V1CertImpl";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        try {
10709
d865c9f21240 7092375: Security Libraries don't build with javac -Werror
xuelei
parents: 5506
diff changeset
   219
            Class<?>[] params = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
            if (value instanceof InputStream) {
10709
d865c9f21240 7092375: Security Libraries don't build with javac -Werror
xuelei
parents: 5506
diff changeset
   221
                params = new Class<?>[] { InputStream.class };
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            } else if (value instanceof byte[]) {
10709
d865c9f21240 7092375: Security Libraries don't build with javac -Werror
xuelei
parents: 5506
diff changeset
   223
                params = new Class<?>[] { value.getClass() };
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
            } else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                throw new CertificateException("Unsupported argument type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
            Class<?> certClass = Class.forName(className);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
            // get the appropriate constructor and instantiate it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            Constructor<?> cons = certClass.getConstructor(params);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
            // get a new instance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
            Object obj = cons.newInstance(new Object[] {value});
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            return (X509Certificate)obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        } catch (ClassNotFoundException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
          throw new CertificateException("Could not find class: " + e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        } catch (IllegalAccessException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
          throw new CertificateException("Could not access class: " + e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        } catch (InstantiationException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
          throw new CertificateException("Problems instantiating: " + e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        } catch (InvocationTargetException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
          throw new CertificateException("InvocationTargetException: "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                                         + e.getTargetException());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        } catch (NoSuchMethodException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
          throw new CertificateException("Could not find class method: "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                                          + e.getMessage());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     * Checks that the certificate is currently valid. It is if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * the current date and time are within the validity period given in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * The validity period consists of two date/time values:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * the first and last dates (and times) on which the certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * is valid. It is defined in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * ASN.1 as:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * <pre>
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   260
     * validity             Validity
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   261
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * Validity ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     *     notBefore      CertificateValidityDate,
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   264
     *     notAfter       CertificateValidityDate }
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   265
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * CertificateValidityDate ::= CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     *     utcTime        UTCTime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     *     generalTime    GeneralizedTime }
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
     * @exception CertificateExpiredException if the certificate has expired.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * @exception CertificateNotYetValidException if the certificate is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     *            yet valid.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    public abstract void checkValidity()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
        throws CertificateExpiredException, CertificateNotYetValidException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * Checks that the specified date is within the certificate's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * validity period. In other words, this determines whether the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     * certificate would be valid at the specified date/time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @param date the Date to check against to see if this certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *        is valid at that date/time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @exception CertificateExpiredException if the certificate has expired
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   286
     *            with respect to the {@code date} supplied.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     * @exception CertificateNotYetValidException if the certificate is not
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   288
     *            yet valid with respect to the {@code date} supplied.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * @see #checkValidity()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    public abstract void checkValidity(Date date)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        throws CertificateExpiredException, CertificateNotYetValidException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    /**
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   295
     * Gets the {@code version} (version number) value from the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * certificate. The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * <pre>
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   298
     * version         [0]  EXPLICIT Version DEFAULT v1
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   299
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * Version  ::=  INTEGER  {  v1(0), v2(1), v3(2)  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @return the version number from the ASN.1 encoding, i.e. 0, 1 or 2.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    public abstract int getVersion();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
    /**
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   308
     * Gets the {@code serialNumber} value from the certificate.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * The serial number is an integer assigned by the certification
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * authority to each certificate. It must be unique for each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * certificate issued by a given CA (i.e., the issuer name and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * serial number identify a unique certificate).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * <pre>
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   315
     * serialNumber     CertificateSerialNumber
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * CertificateSerialNumber  ::=  INTEGER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @return the serial number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    public abstract BigInteger getSerialNumber();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    /**
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   325
     * Gets the {@code issuer} (issuer distinguished name) value from
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * the certificate. The issuer name identifies the entity that signed (and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * issued) the certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * <p>The issuer name field contains an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * X.500 distinguished name (DN).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * <pre>
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   333
     * issuer    Name
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * Name ::= CHOICE { RDNSequence }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * RelativeDistinguishedName ::=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     *     SET OF AttributeValueAssertion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * AttributeValueAssertion ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     *                               AttributeType,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     *                               AttributeValue }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     * AttributeType ::= OBJECT IDENTIFIER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * AttributeValue ::= ANY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * </pre>
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   346
     * The {@code Name} describes a hierarchical name composed of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * attributes, such as country name, and corresponding values, such as US.
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   348
     * The type of the {@code AttributeValue} component is determined by
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   349
     * the {@code AttributeType}; in general it will be a
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   350
     * {@code directoryString}. A {@code directoryString} is usually
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   351
     * one of {@code PrintableString},
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   352
     * {@code TeletexString} or {@code UniversalString}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * @return a Principal whose name is the issuer distinguished name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    public abstract Principal getIssuerDN();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    /**
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   359
     * Gets the {@code subject} (subject distinguished name) value
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * from the certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * subject    Name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     *
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   366
     * <p>See {@link #getIssuerDN() getIssuerDN} for {@code Name}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * and other relevant definitions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * @return a Principal whose name is the subject name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * @see #getIssuerDN()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    public abstract Principal getSubjectDN();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    /**
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   375
     * Gets the {@code notBefore} date from the validity period of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * the certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * The relevant ASN.1 definitions are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * <pre>
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   379
     * validity             Validity
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * Validity ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     *     notBefore      CertificateValidityDate,
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   383
     *     notAfter       CertificateValidityDate }
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   384
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * CertificateValidityDate ::= CHOICE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     *     utcTime        UTCTime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     *     generalTime    GeneralizedTime }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * @return the start date of the validity period.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * @see #checkValidity()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    public abstract Date getNotBefore();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    /**
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   396
     * Gets the {@code notAfter} date from the validity period of
90
12ba8f0d1494 6634644: broken fragment, should use @link
weijun
parents: 2
diff changeset
   397
     * the certificate. See {@link #getNotBefore() getNotBefore}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * for relevant ASN.1 definitions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * @return the end date of the validity period.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * @see #checkValidity()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    public abstract Date getNotAfter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * Gets the signature algorithm name for the certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * signature algorithm. An example is the string "SHA-1/DSA".
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     * The ASN.1 definition for this is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * <pre>
18771
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   410
     * signatureAlgorithm   AlgorithmIdentifier
9dadb0719cea 8019772: Fix doclint issues in javax.crypto and javax.security subpackages
juh
parents: 14775
diff changeset
   411
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * AlgorithmIdentifier  ::=  SEQUENCE  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     *     algorithm               OBJECT IDENTIFIER,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     *     parameters              ANY DEFINED BY algorithm OPTIONAL  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     *                             -- contains a value of the type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     *                             -- registered for use with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     *                             -- algorithm object identifier value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     *
18830
90956ead732f 8020557: javadoc cleanup in javax.security
juh
parents: 18771
diff changeset
   420
     * <p>The algorithm name is determined from the {@code algorithm}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * OID string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * @return the signature algorithm name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    public abstract String getSigAlgName();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * Gets the signature algorithm OID string from the certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * An OID is represented by a set of positive whole numbers separated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * by periods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * For example, the string "1.2.840.10040.4.3" identifies the SHA-1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * with DSA signature algorithm, as per the PKIX part I.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     *
90
12ba8f0d1494 6634644: broken fragment, should use @link
weijun
parents: 2
diff changeset
   434
     * <p>See {@link #getSigAlgName() getSigAlgName} for
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * relevant ASN.1 definitions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * @return the signature algorithm OID string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    public abstract String getSigAlgOID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     * Gets the DER-encoded signature algorithm parameters from this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * certificate's signature algorithm. In most cases, the signature
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     * algorithm parameters are null; the parameters are usually
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
     * supplied with the certificate's public key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
     *
90
12ba8f0d1494 6634644: broken fragment, should use @link
weijun
parents: 2
diff changeset
   447
     * <p>See {@link #getSigAlgName() getSigAlgName} for
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
     * relevant ASN.1 definitions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * @return the DER-encoded signature algorithm parameters, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     *         null if no parameters are present.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    public abstract byte[] getSigAlgParams();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
}