当前位置: 首页>>代码示例>>Java>>正文


Java CodeSource.getCodeSigners方法代码示例

本文整理汇总了Java中java.security.CodeSource.getCodeSigners方法的典型用法代码示例。如果您正苦于以下问题:Java CodeSource.getCodeSigners方法的具体用法?Java CodeSource.getCodeSigners怎么用?Java CodeSource.getCodeSigners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.CodeSource的用法示例。


在下文中一共展示了CodeSource.getCodeSigners方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: entryNames

import java.security.CodeSource; //导入方法依赖的package包/类
Enumeration<String> entryNames(CodeSource[] cs) {
    ensureInitialization();
    if (jv != null) {
        return jv.entryNames(this, cs);
    }

    /*
     * JAR file has no signed content. Is there a non-signing
     * code source?
     */
    boolean includeUnsigned = false;
    for (CodeSource c : cs) {
        if (c.getCodeSigners() == null) {
            includeUnsigned = true;
            break;
        }
    }
    if (includeUnsigned) {
        return unsignedEntryNames();
    } else {
        return new Enumeration<>() {

            public boolean hasMoreElements() {
                return false;
            }

            public String nextElement() {
                throw new NoSuchElementException();
            }
        };
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:JarFile.java

示例2: loadJar

import java.security.CodeSource; //导入方法依赖的package包/类
/**
 * Loads specified JAR.
 *
 * @param jarFileInfo
 * @throws IOException
 */
private void loadJar(JarFileInfo jarFileInfo) throws IOException {
    lstJarFile.add(jarFileInfo);
    try {
        Enumeration<JarEntry> en = jarFileInfo.jarFile.entries();
        final String EXT_JAR = ".jar";
        while (en.hasMoreElements()) {
            JarEntry je = en.nextElement();
            if (je.isDirectory()) {
                continue;
            }
            String s = je.getName().toLowerCase(); // JarEntry name
            if (s.lastIndexOf(EXT_JAR) == s.length() - EXT_JAR.length()) {
                JarEntryInfo inf = new JarEntryInfo(jarFileInfo, je);
                File fileTemp = createTempFile(inf);
                logInfo(LogArea.JAR, "Loading inner JAR %s from temp file %s",
                        inf.jarEntry, getFilename4Log(fileTemp));
                // Construct ProtectionDomain for this inner JAR:
                URL url = fileTemp.toURI().toURL();
                ProtectionDomain pdParent = jarFileInfo.pd;
                // 'csParent' is never null: top JAR has it, JCL creates it for child JAR:
                CodeSource csParent = pdParent.getCodeSource();
                Certificate[] certParent = csParent.getCertificates();
                CodeSource csChild = (certParent == null ? new CodeSource(url, csParent.getCodeSigners())
                                                         : new CodeSource(url, certParent));
                ProtectionDomain pdChild = new ProtectionDomain(csChild,
                        pdParent.getPermissions(), pdParent.getClassLoader(), pdParent.getPrincipals());
                loadJar(new JarFileInfo(
                        new JarFile(fileTemp), inf.getName(), jarFileInfo, pdChild, fileTemp));
            }
        }
    } catch (JarClassLoaderException e) {
        throw new RuntimeException(
                "ERROR on loading inner JAR: " + e.getMessageAll());
    }
}
 
开发者ID:Energyxxer,项目名称:Vanilla-Injection,代码行数:42,代码来源:JarClassLoader.java


注:本文中的java.security.CodeSource.getCodeSigners方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。