Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
08818e85
Commit
08818e85
authored
Jun 26, 2020
by
vvb2060
Committed by
John Wu
Jul 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove force_pm_install
gms package verifier only checks the `notBefore` value of the certificate
parent
706eba32
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
24 deletions
+4
-24
Keygen.kt
app/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt
+3
-13
PatchAPK.kt
...src/main/java/com/topjohnwu/magisk/core/utils/PatchAPK.kt
+1
-1
manager.sh
app/src/main/res/raw/manager.sh
+0
-10
No files found.
app/src/main/java/com/topjohnwu/magisk/core/utils/Keygen.kt
View file @
08818e85
...
...
@@ -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
)
...
...
app/src/main/java/com/topjohnwu/magisk/core/utils/PatchAPK.kt
View file @
08818e85
...
...
@@ -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
()
...
...
app/src/main/res/raw/manager.sh
View file @
08818e85
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment