jdk/src/share/classes/sun/security/pkcs/PKCS7.java
changeset 10336 0bb1999251f8
parent 9365 469cd39a25de
child 10788 680a3dbfcaba
equal deleted inserted replaced
10335:3c7eda3ab2f5 10336:0bb1999251f8
   151     {
   151     {
   152         contentInfo = new ContentInfo(derin, oldStyle);
   152         contentInfo = new ContentInfo(derin, oldStyle);
   153         contentType = contentInfo.contentType;
   153         contentType = contentInfo.contentType;
   154         DerValue content = contentInfo.getContent();
   154         DerValue content = contentInfo.getContent();
   155 
   155 
   156         if (contentType.equals(ContentInfo.SIGNED_DATA_OID)) {
   156         if (contentType.equals((Object)ContentInfo.SIGNED_DATA_OID)) {
   157             parseSignedData(content);
   157             parseSignedData(content);
   158         } else if (contentType.equals(ContentInfo.OLD_SIGNED_DATA_OID)) {
   158         } else if (contentType.equals((Object)ContentInfo.OLD_SIGNED_DATA_OID)) {
   159             // This is for backwards compatibility with JDK 1.1.x
   159             // This is for backwards compatibility with JDK 1.1.x
   160             parseOldSignedData(content);
   160             parseOldSignedData(content);
   161         } else if (contentType.equals(ContentInfo.NETSCAPE_CERT_SEQUENCE_OID)){
   161         } else if (contentType.equals((Object)
       
   162                        ContentInfo.NETSCAPE_CERT_SEQUENCE_OID)){
   162             parseNetscapeCertChain(content);
   163             parseNetscapeCertChain(content);
   163         } else {
   164         } else {
   164             throw new ParsingException("content type " + contentType +
   165             throw new ParsingException("content type " + contentType +
   165                                        " not supported.");
   166                                        " not supported.");
   166         }
   167         }
   475                 else {
   476                 else {
   476                     try {
   477                     try {
   477                         byte[] encoded = certificates[i].getEncoded();
   478                         byte[] encoded = certificates[i].getEncoded();
   478                         implCerts[i] = new X509CertImpl(encoded);
   479                         implCerts[i] = new X509CertImpl(encoded);
   479                     } catch (CertificateException ce) {
   480                     } catch (CertificateException ce) {
   480                         IOException ie = new IOException(ce.getMessage());
   481                         throw new IOException(ce);
   481                         ie.initCause(ce);
       
   482                         throw ie;
       
   483                     }
   482                     }
   484                 }
   483                 }
   485             }
   484             }
   486 
   485 
   487             // Add the certificate set (tagged with [0] IMPLICIT)
   486             // Add the certificate set (tagged with [0] IMPLICIT)
   499                 else {
   498                 else {
   500                     try {
   499                     try {
   501                         byte[] encoded = crl.getEncoded();
   500                         byte[] encoded = crl.getEncoded();
   502                         implCRLs.add(new X509CRLImpl(encoded));
   501                         implCRLs.add(new X509CRLImpl(encoded));
   503                     } catch (CRLException ce) {
   502                     } catch (CRLException ce) {
   504                         IOException ie = new IOException(ce.getMessage());
   503                         throw new IOException(ce);
   505                         ie.initCause(ce);
       
   506                         throw ie;
       
   507                     }
   504                     }
   508                 }
   505                 }
   509             }
   506             }
   510 
   507 
   511             // Add the CRL set (tagged with [1] IMPLICIT)
   508             // Add the CRL set (tagged with [1] IMPLICIT)
   560             SignerInfo signerInfo = verify(signerInfos[i], bytes);
   557             SignerInfo signerInfo = verify(signerInfos[i], bytes);
   561             if (signerInfo != null) {
   558             if (signerInfo != null) {
   562                 intResult.addElement(signerInfo);
   559                 intResult.addElement(signerInfo);
   563             }
   560             }
   564         }
   561         }
   565         if (intResult.size() != 0) {
   562         if (!intResult.isEmpty()) {
   566 
   563 
   567             SignerInfo[] result = new SignerInfo[intResult.size()];
   564             SignerInfo[] result = new SignerInfo[intResult.size()];
   568             intResult.copyInto(result);
   565             intResult.copyInto(result);
   569             return result;
   566             return result;
   570         }
   567         }