jdk/src/share/classes/java/security/cert/CertificateRevokedException.java
author xuelei
Wed, 20 Jan 2010 21:38:37 +0800
changeset 4807 2521b7dcf505
parent 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
6862064: incorrect implementation of PKIXParameters.clone() Reviewed-by: weijun, mullan
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 2007 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 java.security.cert;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.ObjectInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.io.ObjectOutputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.util.Collections;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.util.Date;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.util.HashMap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.util.Map.Entry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import javax.security.auth.x500.X500Principal;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import sun.security.util.ObjectIdentifier;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import sun.security.x509.InvalidityDateExtension;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * An exception that indicates an X.509 certificate is revoked. A
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <code>CertificateRevokedException</code> contains additional information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * about the revoked certificate, such as the date on which the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * certificate was revoked and the reason it was revoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * @author Sean Mullan
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * @since 1.7
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * @see CertPathValidatorException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
public class CertificateRevokedException extends CertificateException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    private static final long serialVersionUID = 7839996631571608627L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * @serial the date on which the certificate was revoked
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    private Date revocationDate;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     * @serial the revocation reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    private final CRLReason reason;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     * @serial the name of the authority that signed the certificate's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     *    revocation status information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private final X500Principal authority;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    private transient Map<String, Extension> extensions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * Constructs a <code>CertificateRevokedException</code> with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * the specified revocation date, reason code, authority name, and map
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * of extensions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * @param revocationDate the date on which the certificate was revoked. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     *    date is copied to protect against subsequent modification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * @param reason the revocation reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @param extensions a map of X.509 Extensions. Each key is an OID String
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     *    that maps to the corresponding Extension. The map is copied to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     *    prevent subsequent modification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @param authority the name of the authority that signed the certificate's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     *    revocation status information
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * @throws NullPointerException if <code>revocationDate</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     *    <code>reason</code>, <code>authority</code>, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     *    <code>extensions</code> is <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    public CertificateRevokedException(Date revocationDate, CRLReason reason,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        X500Principal authority, Map<String, Extension> extensions) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        if (revocationDate == null || reason == null || authority == null ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            extensions == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            throw new NullPointerException();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        this.revocationDate = new Date(revocationDate.getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        this.reason = reason;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        this.authority = authority;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        this.extensions = new HashMap(extensions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * Returns the date on which the certificate was revoked. A new copy is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * returned each time the method is invoked to protect against subsequent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * modification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @return the revocation date
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    public Date getRevocationDate() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        return (Date) revocationDate.clone();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * Returns the reason the certificate was revoked.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @return the revocation reason
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    public CRLReason getRevocationReason() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        return reason;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
     * Returns the name of the authority that signed the certificate's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * revocation status information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @return the name of the authority that signed the certificate's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *    revocation status information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    public X500Principal getAuthorityName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        return authority;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * Returns the invalidity date, as specifed in the Invalidity Date
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * extension of this <code>CertificateRevokedException</code>. The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * invalidity date is the date on which it is known or suspected that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * private key was compromised or that the certificate otherwise became
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * invalid. This implementation calls <code>getExtensions()</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * checks the returned map for an entry for the Invalidity Date extension
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * OID ("2.5.29.24"). If found, it returns the invalidity date in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * extension; otherwise null. A new Date object is returned each time the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * method is invoked to protect against subsequent modification.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * @return the invalidity date, or <code>null</code> if not specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    public Date getInvalidityDate() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        Extension ext = getExtensions().get("2.5.29.24");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        if (ext == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
                Date invalidity =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
                    (Date) InvalidityDateExtension.toImpl(ext).get("DATE");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                return new Date(invalidity.getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
            } catch (IOException ioe) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * Returns a map of X.509 extensions containing additional information
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * about the revoked certificate, such as the Invalidity Date
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * Extension. Each key is an OID String that maps to the corresponding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * Extension.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @return an unmodifiable map of X.509 extensions, or an empty map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *    if there are no extensions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    public Map<String, Extension> getExtensions() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
        return Collections.unmodifiableMap(extensions);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    public String getMessage() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        return "Certificate has been revoked, reason: "
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
               + reason + ", revocation date: " + revocationDate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
               + ", authority: " + authority + ", extensions: " + extensions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * Serialize this <code>CertificateRevokedException</code> instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * @serialData the size of the extensions map (int), followed by all of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * the extensions in the map, in no particular order. For each extension,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     * the following data is emitted: the OID String (Object), the criticality
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * flag (boolean), the length of the encoded extension value byte array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * (int), and the encoded extension value bytes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    private void writeObject(ObjectOutputStream oos) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        // Write out the non-transient fields
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        // (revocationDate, reason, authority)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        oos.defaultWriteObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
        // Write out the size (number of mappings) of the extensions map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        oos.writeInt(extensions.size());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        // For each extension in the map, the following are emitted (in order):
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        // the OID String (Object), the criticality flag (boolean), the length
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        // of the encoded extension value byte array (int), and the encoded
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        // extension value byte array. The extensions themselves are emitted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        // in no particular order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
        for (Map.Entry<String, Extension> entry : extensions.entrySet()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            Extension ext = entry.getValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            oos.writeObject(ext.getId());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
            oos.writeBoolean(ext.isCritical());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
            byte[] extVal = ext.getValue();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            oos.writeInt(extVal.length);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
            oos.write(extVal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * Deserialize the <code>CertificateRevokedException</code> instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    private void readObject(ObjectInputStream ois)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        throws IOException, ClassNotFoundException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        // Read in the non-transient fields
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        // (revocationDate, reason, authority)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        ois.defaultReadObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        // Defensively copy the revocation date
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        revocationDate = new Date(revocationDate.getTime());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
        // Read in the size (number of mappings) of the extensions map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        // and create the extensions map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        int size = ois.readInt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        if (size == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            extensions = Collections.emptyMap();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
            extensions = new HashMap<String, Extension>(size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        // Read in the extensions and put the mappings in the extensions map
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        for (int i = 0; i < size; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
            String oid = (String) ois.readObject();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
            boolean critical = ois.readBoolean();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
            int length = ois.readInt();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            byte[] extVal = new byte[length];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            ois.readFully(extVal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
            Extension ext = sun.security.x509.Extension.newExtension
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                (new ObjectIdentifier(oid), critical, extVal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            extensions.put(oid, ext);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
}