From 0cd4fa6fa010602a5102dfe4e8eabc4d08d0da25 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Tue, 11 Sep 2018 10:48:36 -0400 Subject: [PATCH] Simplify SignAPK code --- build.gradle | 2 +- utils/src/main/java/com/topjohnwu/utils/SignAPK.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 1e39012d6..578ae0371 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.0-rc02' + classpath 'com.android.tools.build:gradle:3.2.0-rc03' // NOTE: Do not place your application dependencies here; they belong diff --git a/utils/src/main/java/com/topjohnwu/utils/SignAPK.java b/utils/src/main/java/com/topjohnwu/utils/SignAPK.java index 12dbc6755..5586ea40e 100644 --- a/utils/src/main/java/com/topjohnwu/utils/SignAPK.java +++ b/utils/src/main/java/com/topjohnwu/utils/SignAPK.java @@ -86,9 +86,8 @@ public class SignAPK { JarMap input, OutputStream output) throws Exception { KeyStore ks = KeyStore.getInstance("JKS"); ks.load(jks, keyStorePass.toCharArray()); - KeyStore.ProtectionParameter prot = new KeyStore.PasswordProtection(keyPass.toCharArray()); X509Certificate cert = (X509Certificate) ks.getCertificate(alias); - PrivateKey key = ((KeyStore.PrivateKeyEntry) ks.getEntry(alias, prot)).getPrivateKey(); + PrivateKey key = (PrivateKey) ks.getKey(alias, keyPass.toCharArray()); sign(cert, key, input, output); }