jdk/src/share/classes/sun/security/x509/IssuingDistributionPointExtension.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2005-2006 Sun Microsystems, Inc.  All Rights Reserved.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
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.x509;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.OutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import sun.security.util.DerInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.security.util.DerOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.security.util.DerValue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * Represents the CRL Issuing Distribution Point Extension (OID = 2.5.29.28).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * The issuing distribution point is a critical CRL extension that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * identifies the CRL distribution point and scope for a particular CRL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * and it indicates whether the CRL covers revocation for end entity
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * certificates only, CA certificates only, attribute certificates only,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * or a limited set of reason codes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * The extension is defined in Section 5.2.5 of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <a href="http://www.ietf.org/rfc/rfc3280.txt">Internet X.509 PKI Certific
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
ate and Certificate Revocation List (CRL) Profile</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * Its ASN.1 definition is as follows:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *     id-ce-issuingDistributionPoint OBJECT IDENTIFIER ::= { id-ce 28 }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *     issuingDistributionPoint ::= SEQUENCE {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *          distributionPoint          [0] DistributionPointName OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *          onlyContainsUserCerts      [1] BOOLEAN DEFAULT FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *          onlyContainsCACerts        [2] BOOLEAN DEFAULT FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *          onlySomeReasons            [3] ReasonFlags OPTIONAL,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *          indirectCRL                [4] BOOLEAN DEFAULT FALSE,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *          onlyContainsAttributeCerts [5] BOOLEAN DEFAULT FALSE }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * @see DistributionPoint
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
public class IssuingDistributionPointExtension extends Extension
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        implements CertAttrSet<String> {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * Identifier for this attribute, to be used with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * get, set, delete methods of Certificate, x509 type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    public static final String IDENT =
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                                "x509.info.extensions.IssuingDistributionPoint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * Attribute names.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public static final String NAME = "IssuingDistributionPoint";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    public static final String POINT = "point";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public static final String REASONS = "reasons";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public static final String ONLY_USER_CERTS = "only_user_certs";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    public static final String ONLY_CA_CERTS = "only_ca_certs";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    public static final String ONLY_ATTRIBUTE_CERTS = "only_attribute_certs";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public static final String INDIRECT_CRL = "indirect_crl";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * The distribution point name for the CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    private DistributionPointName distributionPoint = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * The scope settings for the CRL.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    private ReasonFlags revocationReasons = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    private boolean hasOnlyUserCerts = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    private boolean hasOnlyCACerts = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    private boolean hasOnlyAttributeCerts = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    private boolean isIndirectCRL = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * ASN.1 context specific tag values
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    private static final byte TAG_DISTRIBUTION_POINT = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    private static final byte TAG_ONLY_USER_CERTS = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    private static final byte TAG_ONLY_CA_CERTS = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    private static final byte TAG_ONLY_SOME_REASONS = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    private static final byte TAG_INDIRECT_CRL = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    private static final byte TAG_ONLY_ATTRIBUTE_CERTS = 5;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * Creates a critical IssuingDistributionPointExtension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @param distributionPoint the name of the distribution point, or null for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     *        none.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * @param revocationReasons the revocation reasons associated with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     *        distribution point, or null for none.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * @param hasOnlyUserCerts if <code>true</code> then scope of the CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *        includes only user certificates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * @param hasOnlyCACerts if <code>true</code> then scope of the CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *        includes only CA certificates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @param hasOnlyAttributeCerts if <code>true</code> then scope of the CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     *        includes only attribute certificates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * @param isIndirectCRL if <code>true</code> then the scope of the CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *        includes certificates issued by authorities other than the CRL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     *        issuer. The responsible authority is indicated by a certificate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     *        issuer CRL entry extension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * @throws IllegalArgumentException if more than one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *        <code>hasOnlyUserCerts</code>, <code>hasOnlyCACerts</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     *        <code>hasOnlyAttributeCerts</code> is set to <code>true</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * @throws IOException on encoding error.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    public IssuingDistributionPointExtension(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        DistributionPointName distributionPoint, ReasonFlags revocationReasons,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        boolean hasOnlyUserCerts, boolean hasOnlyCACerts,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
        boolean hasOnlyAttributeCerts, boolean isIndirectCRL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
            throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        if ((hasOnlyUserCerts && (hasOnlyCACerts || hasOnlyAttributeCerts)) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
            (hasOnlyCACerts && (hasOnlyUserCerts || hasOnlyAttributeCerts)) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            (hasOnlyAttributeCerts && (hasOnlyUserCerts || hasOnlyCACerts))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            throw new IllegalArgumentException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                "Only one of hasOnlyUserCerts, hasOnlyCACerts, " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                "hasOnlyAttributeCerts may be set to true");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        this.critical = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        this.distributionPoint = distributionPoint;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        this.revocationReasons = revocationReasons;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        this.hasOnlyUserCerts = hasOnlyUserCerts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        this.hasOnlyCACerts = hasOnlyCACerts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        this.hasOnlyAttributeCerts = hasOnlyAttributeCerts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        this.isIndirectCRL = isIndirectCRL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        encodeThis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * Creates a critical IssuingDistributionPointExtension from its
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * DER-encoding.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * @param critical true if the extension is to be treated as critical.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @param value the DER-encoded value. It must be a <code>byte[]</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @exception IOException on decoding error.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public IssuingDistributionPointExtension(Boolean critical, Object value)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        this.critical = critical.booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        if (!(value instanceof byte[])) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            throw new IOException("Illegal argument type");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        extensionValue = (byte[])value;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
        DerValue val = new DerValue(extensionValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
        if (val.tag != DerValue.tag_Sequence) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            throw new IOException("Invalid encoding for " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                                  "IssuingDistributionPointExtension.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        // All the elements in issuingDistributionPoint are optional
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        if ((val.data == null) || (val.data.available() == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        DerInputStream in = val.data;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        while (in != null && in.available() != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            DerValue opt = in.getDerValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            if (opt.isContextSpecific(TAG_DISTRIBUTION_POINT) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                opt.isConstructed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                distributionPoint =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
                    new DistributionPointName(opt.data.getDerValue());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            } else if (opt.isContextSpecific(TAG_ONLY_USER_CERTS) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
                       !opt.isConstructed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
                opt.resetTag(DerValue.tag_Boolean);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                hasOnlyUserCerts = opt.getBoolean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            } else if (opt.isContextSpecific(TAG_ONLY_CA_CERTS) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                  !opt.isConstructed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                opt.resetTag(DerValue.tag_Boolean);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                hasOnlyCACerts = opt.getBoolean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            } else if (opt.isContextSpecific(TAG_ONLY_SOME_REASONS) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                       !opt.isConstructed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                revocationReasons = new ReasonFlags(opt); // expects tag implicit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
            } else if (opt.isContextSpecific(TAG_INDIRECT_CRL) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                       !opt.isConstructed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                opt.resetTag(DerValue.tag_Boolean);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                isIndirectCRL = opt.getBoolean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
            } else if (opt.isContextSpecific(TAG_ONLY_ATTRIBUTE_CERTS) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                       !opt.isConstructed()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                opt.resetTag(DerValue.tag_Boolean);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                hasOnlyAttributeCerts = opt.getBoolean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                throw new IOException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                    ("Invalid encoding of IssuingDistributionPoint");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * Returns the name of this attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    public String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        return NAME;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * Encodes the issuing distribution point extension and writes it to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * DerOutputStream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @param out the output stream.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     * @exception IOException on encoding error.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    public void encode(OutputStream out) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        DerOutputStream tmp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        if (this.extensionValue == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            this.extensionId = PKIXExtensions.IssuingDistributionPoint_Id;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            this.critical = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            encodeThis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        super.encode(tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
        out.write(tmp.toByteArray());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Sets the attribute value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    public void set(String name, Object obj) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        if (name.equalsIgnoreCase(POINT)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
            if (!(obj instanceof DistributionPointName)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                throw new IOException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
                    "Attribute value should be of type DistributionPointName.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
            distributionPoint = (DistributionPointName)obj;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
        } else if (name.equalsIgnoreCase(REASONS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
            if (!(obj instanceof ReasonFlags)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                throw new IOException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                    "Attribute value should be of type ReasonFlags.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        } else if (name.equalsIgnoreCase(INDIRECT_CRL)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
            if (!(obj instanceof Boolean)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                throw new IOException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                    "Attribute value should be of type Boolean.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
            isIndirectCRL = ((Boolean)obj).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
        } else if (name.equalsIgnoreCase(ONLY_USER_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            if (!(obj instanceof Boolean)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                throw new IOException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                    "Attribute value should be of type Boolean.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            hasOnlyUserCerts = ((Boolean)obj).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        } else if (name.equalsIgnoreCase(ONLY_CA_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
            if (!(obj instanceof Boolean)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                throw new IOException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
                    "Attribute value should be of type Boolean.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
            hasOnlyCACerts = ((Boolean)obj).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        } else if (name.equalsIgnoreCase(ONLY_ATTRIBUTE_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
            if (!(obj instanceof Boolean)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                throw new IOException(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                    "Attribute value should be of type Boolean.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            hasOnlyAttributeCerts = ((Boolean)obj).booleanValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
            throw new IOException("Attribute name [" + name +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                "] not recognized by " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                "CertAttrSet:IssuingDistributionPointExtension.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        encodeThis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * Gets the attribute value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    public Object get(String name) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
        if (name.equalsIgnoreCase(POINT)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            return distributionPoint;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
        } else if (name.equalsIgnoreCase(INDIRECT_CRL)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
            return Boolean.valueOf(isIndirectCRL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
        } else if (name.equalsIgnoreCase(REASONS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
            return revocationReasons;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        } else if (name.equalsIgnoreCase(ONLY_USER_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
            return Boolean.valueOf(hasOnlyUserCerts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        } else if (name.equalsIgnoreCase(ONLY_CA_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            return Boolean.valueOf(hasOnlyCACerts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
        } else if (name.equalsIgnoreCase(ONLY_ATTRIBUTE_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
            return Boolean.valueOf(hasOnlyAttributeCerts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
            throw new IOException("Attribute name [" + name +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                "] not recognized by " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                "CertAttrSet:IssuingDistributionPointExtension.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * Deletes the attribute value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    public void delete(String name) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
        if (name.equalsIgnoreCase(POINT)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
            distributionPoint = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
        } else if (name.equalsIgnoreCase(INDIRECT_CRL)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
            isIndirectCRL = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
        } else if (name.equalsIgnoreCase(REASONS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
            revocationReasons = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
        } else if (name.equalsIgnoreCase(ONLY_USER_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
            hasOnlyUserCerts = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        } else if (name.equalsIgnoreCase(ONLY_CA_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
            hasOnlyCACerts = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        } else if (name.equalsIgnoreCase(ONLY_ATTRIBUTE_CERTS)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
            hasOnlyAttributeCerts = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
            throw new IOException("Attribute name [" + name +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
                "] not recognized by " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
                "CertAttrSet:IssuingDistributionPointExtension.");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
        encodeThis();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     * Returns an enumeration of names of attributes existing within this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    public Enumeration<String> getElements() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
        AttributeNameEnumeration elements = new AttributeNameEnumeration();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        elements.addElement(POINT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        elements.addElement(REASONS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        elements.addElement(ONLY_USER_CERTS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        elements.addElement(ONLY_CA_CERTS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        elements.addElement(ONLY_ATTRIBUTE_CERTS);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        elements.addElement(INDIRECT_CRL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        return elements.elements();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     // Encodes this extension value
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    private void encodeThis() throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        if (distributionPoint == null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
            revocationReasons == null &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            !hasOnlyUserCerts &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            !hasOnlyCACerts &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            !hasOnlyAttributeCerts &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
            !isIndirectCRL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
            this.extensionValue = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        DerOutputStream tagged = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        if (distributionPoint != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            DerOutputStream tmp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            distributionPoint.encode(tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, true,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
                TAG_DISTRIBUTION_POINT), tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
        if (hasOnlyUserCerts) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
            DerOutputStream tmp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
            tmp.putBoolean(hasOnlyUserCerts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
                TAG_ONLY_USER_CERTS), tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        if (hasOnlyCACerts) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            DerOutputStream tmp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
            tmp.putBoolean(hasOnlyCACerts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
                TAG_ONLY_CA_CERTS), tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        if (revocationReasons != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            DerOutputStream tmp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            revocationReasons.encode(tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                TAG_ONLY_SOME_REASONS), tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
        if (isIndirectCRL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
            DerOutputStream tmp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            tmp.putBoolean(isIndirectCRL);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                TAG_INDIRECT_CRL), tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
        if (hasOnlyAttributeCerts) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
            DerOutputStream tmp = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
            tmp.putBoolean(hasOnlyAttributeCerts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            tagged.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT, false,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                TAG_ONLY_ATTRIBUTE_CERTS), tmp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        DerOutputStream seq = new DerOutputStream();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        seq.write(DerValue.tag_Sequence, tagged);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        this.extensionValue = seq.toByteArray();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     * Returns the extension as user readable string.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
        StringBuilder sb = new StringBuilder(super.toString());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        sb.append("IssuingDistributionPoint [\n  ");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        if (distributionPoint != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
            sb.append(distributionPoint);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        if (revocationReasons != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            sb.append(revocationReasons);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        sb.append((hasOnlyUserCerts)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                ? ("  Only contains user certs: true")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                : ("  Only contains user certs: false")).append("\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        sb.append((hasOnlyCACerts)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
                ? ("  Only contains CA certs: true")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
                : ("  Only contains CA certs: false")).append("\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        sb.append((hasOnlyAttributeCerts)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
                ? ("  Only contains attribute certs: true")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
                : ("  Only contains attribute certs: false")).append("\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        sb.append((isIndirectCRL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
                ? ("  Indirect CRL: true")
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
                : ("  Indirect CRL: false")).append("\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        sb.append("]\n");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
        return sb.toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
}