本文整理汇总了Java中kellinwood.security.zipsigner.ZipSigner.signZip方法的典型用法代码示例。如果您正苦于以下问题:Java ZipSigner.signZip方法的具体用法?Java ZipSigner.signZip怎么用?Java ZipSigner.signZip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kellinwood.security.zipsigner.ZipSigner
的用法示例。
在下文中一共展示了ZipSigner.signZip方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
}
示例3: 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);
}
示例4: 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);
}
示例5: 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;
}