• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ZipSigner类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中kellinwood.security.zipsigner.ZipSigner的典型用法代码示例。如果您正苦于以下问题:Java ZipSigner类的具体用法?Java ZipSigner怎么用?Java ZipSigner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ZipSigner类属于kellinwood.security.zipsigner包,在下文中一共展示了ZipSigner类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: signZip

import kellinwood.security.zipsigner.ZipSigner; //导入依赖的package包/类
/** KeyStore-type agnostic.  This method will sign the zip file, automatically handling JKS or BKS keystores. */
public static void signZip( ZipSigner zipSigner,
                     String keystorePath,
                     char[] keystorePw,
                     String certAlias,
                     char[] certPw,
                     String signatureAlgorithm,
                     String inputZipFilename,
                     String outputZipFilename)
    throws Exception
{
    zipSigner.issueLoadingCertAndKeysProgressEvent();
    KeyStore keystore = KeyStoreFileManager.loadKeyStore( keystorePath, keystorePw);
    Certificate cert = keystore.getCertificate(certAlias);
    X509Certificate publicKey = (X509Certificate)cert;
    Key key = keystore.getKey(certAlias, certPw);
    PrivateKey privateKey = (PrivateKey)key;

    zipSigner.setKeys( "custom", publicKey, privateKey, signatureAlgorithm, null);
    zipSigner.signZip( inputZipFilename, outputZipFilename);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:22,代码来源:CustomKeySigner.java


示例2: zipSign

import kellinwood.security.zipsigner.ZipSigner; //导入依赖的package包/类
private static void zipSign(AndroidProjectFolder projectFile) throws Exception {
//        if (!appContext.getString(R.string.keystore).contentEquals(projectFile.jksEmbedded.getName())) {
//             TODO use user defined certificate
//        }

        // use embedded private key
        KeyStore keyStore = projectFile.getKeyStore();
        String keystorePath = keyStore.getFile().getPath();
        char[] keystorePw = keyStore.getPassword();
        String certAlias = keyStore.getCertAlias();
        char[] certPw = keyStore.getCertPassword();
        String signatureAlgorithm = "SHA1withRSA";

        ZipSigner zipsigner = new ZipSigner();
        zipsigner.addProgressListener(new SignProgress() {
            @Override
            public void onProgress(ProgressEvent event) {
                super.onProgress(event);
                System.out.println("Sign progress: " + event.getPercentDone());
            }
        });
        CustomKeySigner.signZip(zipsigner, keystorePath, keystorePw, certAlias,
                certPw, signatureAlgorithm,
                projectFile.getApkUnsigned().getPath(),
                projectFile.getApkUnaligned().getPath());
    }
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:27,代码来源:AndroidBuilder.java


示例3: signZip

import kellinwood.security.zipsigner.ZipSigner; //导入依赖的package包/类
public void signZip(File input, File output) {
    try {
        ZipSigner zipSigner = new ZipSigner();

        X509Certificate cert = (X509Certificate) keyStore.getCertificate(INDEX_CERT_ALIAS);

        KeyPair kp = getKerplappKeypair();
        PrivateKey priv = kp.getPrivate();

        zipSigner.setKeys("kerplapp", cert, priv, DEFAULT_SIG_ALG, null);
        zipSigner.signZip(input.getAbsolutePath(), output.getAbsolutePath());

    } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | GeneralSecurityException | IOException e) {
        Log.e(TAG, "Unable to sign local repo index", e);
    }
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:17,代码来源:LocalRepoKeyStore.java


示例4: signApk

import kellinwood.security.zipsigner.ZipSigner; //导入依赖的package包/类
private void signApk() throws IOException, GeneralSecurityException, IllegalAccessException, InstantiationException, ClassNotFoundException {

        Logger.logd( "ZipSigner.MODE_AUTO_TESTKEY: " + ZipSigner.MODE_AUTO_TESTKEY, verbose, System.out);
        ZipSigner zipsigner = new ZipSigner();
        zipsigner.setKeymode(ZipSigner.MODE_AUTO_TESTKEY);
        zipsigner.signZip(buildFiles.unsigned.getAbsolutePath(), buildFiles.signed.getAbsolutePath());
        Logger.logd("Signed zip: " + buildFiles.signed.getAbsolutePath() + " exists: " + buildFiles.signed.exists(), verbose, System.out);
    }
 
开发者ID:theaetetus,项目名称:AndroidApkMaker,代码行数:9,代码来源:AndroidApkMaker.java


示例5: signApk

import kellinwood.security.zipsigner.ZipSigner; //导入依赖的package包/类
void signApk(File tmpApkFile) throws Exception {
    ZipSigner zipSigner = new ZipSigner();
    zipSigner.setKeymode("auto-testkey");
    String inputFilename = tmpApkFile.getCanonicalPath();
    out.printf(IOutput.Level.VERBOSE, "Signing %s into %s\n", inputFilename, outApkFilename);
    zipSigner.signZip(inputFilename, outApkFilename);
}
 
开发者ID:packmad,项目名称:RmPerm,代码行数:8,代码来源:AbsRmPerm.java


示例6: signApk

import kellinwood.security.zipsigner.ZipSigner; //导入依赖的package包/类
/**
 * Uses the ZipSigner library to sign the apk in the given file.
 *
 * @param unsignedApk
 * @param signedName
 * @return
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 * @throws java.io.IOException
 * @throws java.security.GeneralSecurityException
 */
private File signApk(File unsignedApk, String signedName) throws
        IllegalAccessException,
        InstantiationException,
        ClassNotFoundException,
        IOException,
        GeneralSecurityException {
    File signedApkFile = new File(getMorphCacheDir(), signedName + SIGNED_EXTENSION);
    ZipSigner zipSigner = new ZipSigner();
    zipSigner.setKeymode("auto-testkey");
    zipSigner.signZip(unsignedApk.getPath(), signedApkFile.getPath());

    return signedApkFile;
}
 
开发者ID:droidstealth,项目名称:droid-morph,代码行数:26,代码来源:AppMorph.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SetPermissionRequestProto类代码示例发布时间:2022-05-22
下一篇:
Java VcsRevisionNumber类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap