mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-23 18:15:30 +00:00
Remove force_pm_install
gms package verifier only checks the `notBefore` value of the certificate
This commit is contained in:
parent
706eba329d
commit
08818e8542
@ -35,10 +35,11 @@ class Keygen(context: Context) : CertKeyProvider {
|
||||
private const val ALIAS = "magisk"
|
||||
private val PASSWORD get() = "magisk".toCharArray()
|
||||
private const val TESTKEY_CERT = "61ed377e85d386a8dfee6b864bd85b0bfaa5af81"
|
||||
private const val DNAME = "C=US,ST=California,L=Mountain View,O=Google Inc.,OU=Android,CN=Android"
|
||||
private const val BASE64_FLAG = Base64.NO_PADDING or Base64.NO_WRAP
|
||||
}
|
||||
|
||||
private val start = Calendar.getInstance()
|
||||
private val start = Calendar.getInstance().apply { add(Calendar.MONTH, -3) }
|
||||
private val end = Calendar.getInstance().apply { add(Calendar.YEAR, 30) }
|
||||
|
||||
override val cert get() = provider.cert
|
||||
@ -85,17 +86,6 @@ class Keygen(context: Context) : CertKeyProvider {
|
||||
}
|
||||
}
|
||||
|
||||
private fun randomString(): String {
|
||||
val rand = kotlin.random.Random.Default
|
||||
val len = rand.nextInt(5, 10)
|
||||
val sb = StringBuilder(len)
|
||||
for (i in 0..len) {
|
||||
val idx = rand.nextInt(ALPHANUM.length)
|
||||
sb.append(ALPHANUM[idx])
|
||||
}
|
||||
return sb.toString()
|
||||
}
|
||||
|
||||
private fun init(): KeyStore {
|
||||
val raw = Config.keyStoreRaw
|
||||
val ks = KeyStore.getInstance("PKCS12")
|
||||
@ -117,7 +107,7 @@ class Keygen(context: Context) : CertKeyProvider {
|
||||
|
||||
// Generate new private key and certificate
|
||||
val kp = KeyPairGenerator.getInstance("RSA").apply { initialize(4096) }.genKeyPair()
|
||||
val dname = X500Name("CN=${randomString()}")
|
||||
val dname = X500Name(DNAME)
|
||||
val builder = JcaX509v3CertificateBuilder(dname, BigInteger(160, Random()),
|
||||
start.time, end.time, dname, kp.public)
|
||||
val signer = JcaContentSignerBuilder("SHA1WithRSA").build(kp.private)
|
||||
|
@ -130,7 +130,7 @@ object PatchAPK {
|
||||
|
||||
// Install the application
|
||||
repack.setReadable(true, false)
|
||||
if (!Shell.su("force_pm_install $repack").exec().isSuccess)
|
||||
if (!Shell.su("pm install $repack").exec().isSuccess)
|
||||
return false
|
||||
|
||||
Config.suManager = pkg.toString()
|
||||
|
@ -85,16 +85,6 @@ EOF
|
||||
cd /
|
||||
}
|
||||
|
||||
force_pm_install() {
|
||||
local APK=$1
|
||||
local VERIFY=`settings get global package_verifier_enable`
|
||||
[ "$VERIFY" -eq 1 ] && settings put global package_verifier_enable 0
|
||||
pm install -r $APK
|
||||
local res=$?
|
||||
[ "$VERIFY" -eq 1 ] && settings put global package_verifier_enable 1
|
||||
return $res
|
||||
}
|
||||
|
||||
check_boot_ramdisk() {
|
||||
# Create boolean ISAB
|
||||
[ -z $SLOT ] && ISAB=false || ISAB=true
|
||||
|
Loading…
Reference in New Issue
Block a user