jdk/src/share/classes/sun/security/provider/certpath/Vertex.java
author mullan
Wed, 30 May 2012 17:19:46 -0400
changeset 12860 9ffbd4e43413
parent 10336 0bb1999251f8
permissions -rw-r--r--
6854712: Revocation checking enhancements (JEP-124) 6637288: Add OCSP support to PKIX CertPathBuilder implementation 7126011: ReverseBuilder.getMatchingCACerts may throws NPE Reviewed-by: xuelei
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
     2
 * Copyright (c) 2000, 2012, 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 sun.security.provider.certpath;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    28
import java.io.IOException;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.security.cert.CertificateException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.security.cert.X509Certificate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    32
import sun.security.util.Debug;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import sun.security.x509.AuthorityKeyIdentifierExtension;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.security.x509.KeyIdentifier;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.security.x509.SubjectKeyIdentifierExtension;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.security.x509.X509CertImpl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * This class represents a vertex in the adjacency list. A
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * vertex in the builder's view is just a distinguished name
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * in the directory.  The Vertex contains a certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * along an attempted certification path, along with a pointer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * to a list of certificates that followed this one in various
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * attempted certification paths.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * @author      Sean Mullan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @since       1.4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
public class Vertex {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    private static final Debug debug = Debug.getInstance("certpath");
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    52
    private X509Certificate cert;
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    53
    private int index;
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    54
    private Throwable throwable;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * Constructor; creates vertex with index of -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * Use setIndex method to set another index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     *
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    60
     * @param cert X509Certificate associated with vertex
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    62
    Vertex(X509Certificate cert) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        this.cert = cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
        this.index = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * return the certificate for this vertex
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     *
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    70
     * @returns X509Certificate
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
    72
    public X509Certificate getCertificate() {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        return cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * get the index for this vertex, where the index is the row of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * adjacency list that contains certificates that could follow this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @returns int index for this vertex, or -1 if no following certificates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    public int getIndex() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        return index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * set the index for this vertex, where the index is the row of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * adjacency list that contains certificates that could follow this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * certificate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @param ndx int index for vertex, or -1 if no following certificates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    void setIndex(int ndx) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        index = ndx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * return the throwable associated with this vertex;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     * returns null if none.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * @returns Throwable
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    public Throwable getThrowable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        return throwable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * set throwable associated with this vertex; default value is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * @param throwable Throwable associated with this vertex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     *                  (or null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    void setThrowable(Throwable throwable) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        this.throwable = throwable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * Return full string representation of vertex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @returns String representation of vertex
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     */
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   123
    @Override
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        return certToString() + throwableToString() + indexToString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * Return string representation of this vertex's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * certificate information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * @returns String representation of certificate info
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    public String certToString() {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   135
        StringBuilder sb = new StringBuilder();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        X509CertImpl x509Cert = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        try {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   139
            x509Cert = X509CertImpl.toImpl(cert);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
        } catch (CertificateException ce) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
            if (debug != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                debug.println("Vertex.certToString() unexpected exception");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                ce.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            }
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   145
            return sb.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   148
        sb.append("Issuer:     ").append
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   149
                 (x509Cert.getIssuerX500Principal()).append("\n");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   150
        sb.append("Subject:    ").append
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   151
                 (x509Cert.getSubjectX500Principal()).append("\n");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   152
        sb.append("SerialNum:  ").append
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   153
                 (x509Cert.getSerialNumber().toString(16)).append("\n");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   154
        sb.append("Expires:    ").append
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   155
                 (x509Cert.getNotAfter().toString()).append("\n");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        boolean[] iUID = x509Cert.getIssuerUniqueID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        if (iUID != null) {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   158
            sb.append("IssuerUID:  ");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   159
            for (boolean b : iUID) {
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   160
                sb.append(b ? 1 : 0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            }
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   162
            sb.append("\n");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        boolean[] sUID = x509Cert.getSubjectUniqueID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        if (sUID != null) {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   166
            sb.append("SubjectUID: ");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   167
            for (boolean b : sUID) {
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   168
                sb.append(b ? 1 : 0);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            }
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   170
            sb.append("\n");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        try {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   173
            SubjectKeyIdentifierExtension sKeyID =
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   174
                x509Cert.getSubjectKeyIdentifierExtension();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
            if (sKeyID != null) {
10336
0bb1999251f8 7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents: 5506
diff changeset
   176
                KeyIdentifier keyID = sKeyID.get(
0bb1999251f8 7064075: Security libraries don't build with javac -Xlint:all,-deprecation -Werror
jjg
parents: 5506
diff changeset
   177
                        SubjectKeyIdentifierExtension.KEY_ID);
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   178
                sb.append("SubjKeyID:  ").append(keyID.toString());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            }
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   180
            AuthorityKeyIdentifierExtension aKeyID =
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   181
                x509Cert.getAuthorityKeyIdentifierExtension();
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   182
            if (aKeyID != null) {
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   183
                KeyIdentifier keyID = (KeyIdentifier)aKeyID.get(
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   184
                        AuthorityKeyIdentifierExtension.KEY_ID);
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   185
                sb.append("AuthKeyID:  ").append(keyID.toString());
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   186
            }
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   187
        } catch (IOException e) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            if (debug != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                debug.println("Vertex.certToString() unexpected exception");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        }
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   193
        return sb.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * return Vertex throwable as String compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * the way toString returns other information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * @returns String form of exception (or "none")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    public String throwableToString() {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   203
        StringBuilder sb = new StringBuilder("Exception:  ");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        if (throwable != null)
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   205
            sb.append(throwable.toString());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        else
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   207
            sb.append("null");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   208
        sb.append("\n");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   209
        return sb.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * return Vertex index as String compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * the way other Vertex.xToString() methods display
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * @returns String form of index as "Last cert?  [Yes/No]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    public String moreToString() {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   220
        StringBuilder sb = new StringBuilder("Last cert?  ");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   221
        sb.append((index == -1) ? "Yes" : "No");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   222
        sb.append("\n");
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   223
        return sb.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * return Vertex index as String compatible with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     * the way other Vertex.xToString() methods displays other information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * @returns String form of index as "Index:     [numeric index]"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    public String indexToString() {
12860
9ffbd4e43413 6854712: Revocation checking enhancements (JEP-124)
mullan
parents: 10336
diff changeset
   233
        return "Index:      " + index + "\n";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
}