コード例 #1
0
 /**
  * Return certificates for signed bundle, otherwise null.
  *
  * @return An array of certificates or null.
  */
 public ArrayList getCertificateChains(boolean onlyTrusted) {
   if (checkCerts) {
     Certificate[] c = archive.getCertificates();
     checkCerts = false;
     if (c != null) {
       ArrayList failed = new ArrayList();
       untrustedCerts = Util.getCertificateChains(c, failed);
       if (!failed.isEmpty()) {
         // NYI, log Bundle archive has invalid certificates
         untrustedCerts = null;
       }
     }
   }
   ArrayList res = trustedCerts;
   if (!onlyTrusted && untrustedCerts != null) {
     if (res == null) {
       res = untrustedCerts;
     } else {
       res = new ArrayList(trustedCerts.size() + untrustedCerts.size());
       res.addAll(trustedCerts);
       res.addAll(untrustedCerts);
     }
   }
   return res;
 }
コード例 #2
0
 /** Mark certificate chain as trusted. */
 public void trustCertificateChain(List trustedChain) {
   if (trustedCerts == null) {
     trustedCerts = new ArrayList(untrustedCerts.size());
   }
   trustedCerts.add(trustedChain);
   untrustedCerts.remove(trustedChain);
   if (untrustedCerts.isEmpty()) {
     untrustedCerts = null;
   }
 }
コード例 #3
0
 /**
  * Get a FileArchive handle to a named Jar file or directory within this archive.
  *
  * @param path Name of Jar file or directory to get.
  * @return A FileArchive object representing new archive, null if not found.
  * @exception IOException if we failed to get top of file archive.
  */
 public FileArchive getFileArchive(String path) {
   if (".".equals(path)) {
     return archive;
   }
   if (archives == null) {
     archives = new ArrayList();
   }
   try {
     Archive a = new Archive(archive, path, archives.size() + 1);
     archives.add(a);
     return a;
   } catch (IOException io) {
     // TBD, Where to log this
     return null;
   }
 }