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


Java ManifestEntryVerifier.setEntry方法代码示例

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


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

示例1: beginEntry

import sun.security.util.ManifestEntryVerifier; //导入方法依赖的package包/类
/**
    * This method scans to see which entry we're parsing and
    * keeps various state information depending on what type of
    * file is being parsed.
    */
   public void beginEntry(JarEntry je, ManifestEntryVerifier mev)
throws IOException
   {
if (je == null)
    return;

if (debug != null) {
    debug.println("beginEntry "+je.getName());
}

String name = je.getName();

/*
 * Assumptions:
 * 1. The manifest should be the first entry in the META-INF directory.
 * 2. The .SF/.DSA files follow the manifest, before any normal entries
 * 3. Any of the following will throw a SecurityException:
 *    a. digest mismatch between a manifest section and
 *       the SF section.
 *    b. digest mismatch between the actual jar entry and the manifest
 */

if (parsingMeta) {
    String uname = name.toUpperCase(Locale.ENGLISH);
    if ((uname.startsWith("META-INF/") ||
	 uname.startsWith("/META-INF/"))) {

	if (je.isDirectory()) {
	    mev.setEntry(null, je);
	    return;
	}

	if (SignatureFileVerifier.isBlockOrSF(uname)) {
	    /* We parse only DSA or RSA PKCS7 blocks. */
	    parsingBlockOrSF = true;
	    baos.reset();
	    mev.setEntry(null, je);
	}
	return;
    }
}

if (parsingMeta) {
    doneWithMeta();
}

if (je.isDirectory()) {
    mev.setEntry(null, je);
    return;
}

// be liberal in what you accept. If the name starts with ./, remove
// it as we internally canonicalize it with out the ./.
if (name.startsWith("./"))
    name = name.substring(2);

// be liberal in what you accept. If the name starts with /, remove
// it as we internally canonicalize it with out the /.
if (name.startsWith("/"))
    name = name.substring(1);

// only set the jev object for entries that have a signature
if (sigFileSigners.get(name) != null) {
    mev.setEntry(name, je);
    return;
}

// don't compute the digest for this entry
mev.setEntry(null, je);

return;
   }
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:78,代码来源:JarVerifier.java

示例2: beginEntry

import sun.security.util.ManifestEntryVerifier; //导入方法依赖的package包/类
/**
 * This method scans to see which entry we're parsing and
 * keeps various state information depending on what type of
 * file is being parsed.
 */
public void beginEntry(JarEntry je, ManifestEntryVerifier mev)
    throws IOException
{
    if (je == null)
        return;

    if (debug != null) {
        debug.println("beginEntry "+je.getName());
    }

    String name = je.getName();

    /*
     * Assumptions:
     * 1. The manifest should be the first entry in the META-INF directory.
     * 2. The .SF/.DSA/.EC files follow the manifest, before any normal entries
     * 3. Any of the following will throw a SecurityException:
     *    a. digest mismatch between a manifest section and
     *       the SF section.
     *    b. digest mismatch between the actual jar entry and the manifest
     */

    if (parsingMeta) {
        String uname = name.toUpperCase(Locale.ENGLISH);
        if ((uname.startsWith("META-INF/") ||
             uname.startsWith("/META-INF/"))) {

            if (je.isDirectory()) {
                mev.setEntry(null, je);
                return;
            }

            if (SignatureFileVerifier.isBlockOrSF(uname)) {
                /* We parse only DSA, RSA or EC PKCS7 blocks. */
                parsingBlockOrSF = true;
                baos.reset();
                mev.setEntry(null, je);
            }
            return;
        }
    }

    if (parsingMeta) {
        doneWithMeta();
    }

    if (je.isDirectory()) {
        mev.setEntry(null, je);
        return;
    }

    // be liberal in what you accept. If the name starts with ./, remove
    // it as we internally canonicalize it with out the ./.
    if (name.startsWith("./"))
        name = name.substring(2);

    // be liberal in what you accept. If the name starts with /, remove
    // it as we internally canonicalize it with out the /.
    if (name.startsWith("/"))
        name = name.substring(1);

    // only set the jev object for entries that have a signature
    if (sigFileSigners.get(name) != null) {
        mev.setEntry(name, je);
        return;
    }

    // don't compute the digest for this entry
    mev.setEntry(null, je);

    return;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:78,代码来源:JarVerifier.java


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