Simplify SignAPK code
This commit is contained in:
parent
065949496e
commit
0cd4fa6fa0
@ -7,7 +7,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
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
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
@ -86,9 +86,8 @@ public class SignAPK {
|
|||||||
JarMap input, OutputStream output) throws Exception {
|
JarMap input, OutputStream output) throws Exception {
|
||||||
KeyStore ks = KeyStore.getInstance("JKS");
|
KeyStore ks = KeyStore.getInstance("JKS");
|
||||||
ks.load(jks, keyStorePass.toCharArray());
|
ks.load(jks, keyStorePass.toCharArray());
|
||||||
KeyStore.ProtectionParameter prot = new KeyStore.PasswordProtection(keyPass.toCharArray());
|
|
||||||
X509Certificate cert = (X509Certificate) ks.getCertificate(alias);
|
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);
|
sign(cert, key, input, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user