Example usage for android.util.jar StrictJarFile getCertificateChains

List of usage examples for android.util.jar StrictJarFile getCertificateChains

Introduction

In this page you can find the example usage for android.util.jar StrictJarFile getCertificateChains.

Prototype

public Certificate[][] getCertificateChains(ZipEntry ze) 

Source Link

Document

Return all certificate chains for a given ZipEntry belonging to this jar.

Usage

From source file:android.content.pm.PackageParser.java

private static Certificate[][] loadCertificates(StrictJarFile jarFile, ZipEntry entry)
        throws PackageParserException {
    InputStream is = null;//from w w  w  .ja v a2 s.c  o  m
    try {
        // We must read the stream for the JarEntry to retrieve
        // its certificates.
        is = jarFile.getInputStream(entry);
        readFullyIgnoringContents(is);
        return jarFile.getCertificateChains(entry);
    } catch (IOException | RuntimeException e) {
        throw new PackageParserException(INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION,
                "Failed reading " + entry.getName() + " in " + jarFile, e);
    } finally {
        IoUtils.closeQuietly(is);
    }
}