/** * Get the certificates for a given jar entry, if it is indeed a jar. * * @param container the File from which to read the entry * @param entry the entry of which the certificates are requested * * @return the entry's certificates or null is the container is * not a jar or it has no certificates. * * @exception IOException if the manifest cannot be read. */ private Certificate[] getCertificates(File container, String entry) throws IOException { if (container.isDirectory()) { return null; } JarFile jarFile = (JarFile) jarFiles.get(container); if (jarFile == null) { return null; } JarEntry ent = jarFile.getJarEntry(entry); return ent == null ? null : ent.getCertificates(); }
/** * Get the certificates for a given jar entry, if it is indeed a jar. * * @param container the File from which to read the entry * @param entry the entry of which the certificates are requested * * @return the entry's certificates or null is the container is * not a jar or it has no certificates. */ private Certificate[] getCertificates(final File container, final String entry) { if (container.isDirectory()) { return null; } final JarFile jarFile = jarFiles.get(container); if (jarFile == null) { return null; } final JarEntry ent = jarFile.getJarEntry(entry); return ent == null ? null : ent.getCertificates(); }
/** * Returns all certificates of the {@code JarEntry} referenced by this * {@code JarURLConnection} instance. This method will return {@code null} * until the {@code InputStream} has been completely verified. * * @return the certificates of the {@code JarEntry} as an array. * @throws IOException * if there is an I/O exception occurs while getting the * {@code JarEntry}. */ public Certificate[] getCertificates() throws java.io.IOException { JarEntry jEntry = getJarEntry(); if (jEntry == null) { return null; } return jEntry.getCertificates(); }
/** * Returns the code signers for the digital signatures associated with the * JAR file. If there is no such code signer, it returns {@code null}. Make * sure that the everything is read from the input stream before calling * this method, or else the method returns {@code null}. * * @return the code signers for the JAR entry. * @see CodeSigner */ public CodeSigner[] getCodeSigners() { if (signers == null) { signers = getCodeSigners(getCertificates()); } if (signers == null) { return null; } CodeSigner[] tmp = new CodeSigner[signers.length]; System.arraycopy(signers, 0, tmp, 0, tmp.length); return tmp; }
Certificate[] certs = jarEntry.getCertificates();
Certificate[] certs = makeCerts == false ? jarEntry.getCertificates() : getCertificates(jarEntry);
CodeSource codeS = new CodeSource(codeSourceUrl, entry.getCertificates()); return defineClass(origName, clBuf, 0, clBuf.length, codeS);
private static Certificate[] loadCertificates(JarFile jarFile, JarEntry je, byte[] readBuffer) { try { // We must read the stream for the JarEntry to retrieve // its certificates. InputStream is = new BufferedInputStream(jarFile.getInputStream(je)); while (is.read(readBuffer, 0, readBuffer.length) != -1) { // not using } is.close(); return je != null ? je.getCertificates() : null; } catch (IOException e) { LogUtil.e(TAG, "Exception reading " + je.getName() + " in " + jarFile.getName(), e); } catch (RuntimeException e) { LogUtil.e(TAG, "Exception reading " + je.getName() + " in " + jarFile.getName(), e); } return null; }
/** * Return the certificates of this JarEntry. */ protected Certificate[] doGetCertificates() { if (entry == null) { return null; } return ((JarEntry) entry).getCertificates(); } }
/** * Return the certificates of this JarEntry. */ @Override protected Certificate[] doGetCertificates() { if (entry == null) { return null; } return ((JarEntry) entry).getCertificates(); } }
/** * Return the certificates of this JarEntry. */ @Override protected Certificate[] doGetCertificates() { if (entry == null) { return null; } return ((JarEntry) entry).getCertificates(); } }
/** * Return the certificates of this JarEntry. */ @Override protected Certificate[] doGetCertificates() { if (entry == null) { return null; } return ((JarEntry) entry).getCertificates(); } }
public Certificate[] getCertificates() { return jarEntry.getCertificates(); } }
public Certificate[] getCertificates() { return jarEntry.getCertificates(); } }
public Certificate[] getCertificates() { return jarEntry.getCertificates(); } }
public boolean isSignedBy(JarEntry entry, X509Certificate requiredSigner) { PublicKey requiredPublicKey = requiredSigner.getPublicKey(); for (Certificate cert : entry.getCertificates()) { if (requiredPublicKey.equals(cert.getPublicKey())) { return true; } } return false; }
void setCertificates(java.util.jar.JarEntry entry) { this.certificates = entry.getCertificates(); this.codeSigners = entry.getCodeSigners(); }
void setCertificates(java.util.jar.JarEntry entry) { this.certificates = entry.getCertificates(); this.codeSigners = entry.getCodeSigners(); } @Override
void setCertificates(java.util.jar.JarEntry entry) { this.certificates = entry.getCertificates(); this.codeSigners = entry.getCodeSigners(); }
public static void main(String[] args) throws IOException { JarFile j = new JarFile(new File(args[0])); JarEntry je = j.getJarEntry("hudson/remoting/Channel.class"); if (je==null) throw new IllegalArgumentException(); IOUtils.readLines(j.getInputStream(je)); for (Certificate c : je.getCertificates()) { System.out.println("################# Certificate #################"); System.out.println(c); } } }