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


Java ZipSigner.setKeys方法代码示例

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


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


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