jdk/src/share/classes/sun/security/x509/X509CertImpl.java
changeset 16020 b57c48f16179
parent 14421 a64b2cc9d429
child 16492 4cd9aa345503
equal deleted inserted replaced
16019:1d364f23ece0 16020:b57c48f16179
    39 import java.util.*;
    39 import java.util.*;
    40 
    40 
    41 import javax.security.auth.x500.X500Principal;
    41 import javax.security.auth.x500.X500Principal;
    42 
    42 
    43 import sun.misc.HexDumpEncoder;
    43 import sun.misc.HexDumpEncoder;
    44 import sun.misc.BASE64Decoder;
    44 import java.util.Base64;
    45 import sun.security.util.*;
    45 import sun.security.util.*;
    46 import sun.security.provider.X509Factory;
    46 import sun.security.provider.X509Factory;
    47 
    47 
    48 /**
    48 /**
    49  * The X509CertImpl class represents an X.509 certificate. These certificates
    49  * The X509CertImpl class represents an X.509 certificate. These certificates
   261             throw new IOException("Unable to read InputStream: " +
   261             throw new IOException("Unable to read InputStream: " +
   262                                   ioe1.getMessage());
   262                                   ioe1.getMessage());
   263         }
   263         }
   264         if (line.equals(X509Factory.BEGIN_CERT)) {
   264         if (line.equals(X509Factory.BEGIN_CERT)) {
   265             /* stream appears to be hex-encoded bytes */
   265             /* stream appears to be hex-encoded bytes */
   266             BASE64Decoder         decoder   = new BASE64Decoder();
       
   267             ByteArrayOutputStream decstream = new ByteArrayOutputStream();
   266             ByteArrayOutputStream decstream = new ByteArrayOutputStream();
   268             try {
   267             try {
   269                 while ((line = certBufferedReader.readLine()) != null) {
   268                 while ((line = certBufferedReader.readLine()) != null) {
   270                     if (line.equals(X509Factory.END_CERT)) {
   269                     if (line.equals(X509Factory.END_CERT)) {
   271                         der = new DerValue(decstream.toByteArray());
   270                         der = new DerValue(decstream.toByteArray());
   272                         break;
   271                         break;
   273                     } else {
   272                     } else {
   274                         decstream.write(decoder.decodeBuffer(line));
   273                         decstream.write(Base64.getMimeDecoder().decode(line));
   275                     }
   274                     }
   276                 }
   275                 }
   277             } catch (IOException ioe2) {
   276             } catch (IOException ioe2) {
   278                 throw new IOException("Unable to read InputStream: "
   277                 throw new IOException("Unable to read InputStream: "
   279                                       + ioe2.getMessage());
   278                                       + ioe2.getMessage());