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
f58c73b7
Commit
f58c73b7
authored
Nov 22, 2016
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sign the zip file
parent
2a8477cb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
727 additions
and
15 deletions
+727
-15
.gitignore
.gitignore
+1
-0
build.gradle
app/build.gradle
+4
-0
private.key.pk8
app/src/main/assets/private.key.pk8
+0
-0
public.certificate.x509.pem
app/src/main/assets/public.certificate.x509.pem
+27
-0
ReposAdapter.java
...main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
+28
-4
ZipUtils.java
app/src/main/java/com/topjohnwu/magisk/utils/ZipUtils.java
+665
-9
gradle.properties
gradle.properties
+2
-2
No files found.
.gitignore
View file @
f58c73b7
...
@@ -4,3 +4,4 @@
...
@@ -4,3 +4,4 @@
.idea/
.idea/
/build
/build
app/app-release.apk
app/app-release.apk
*.hprof
app/build.gradle
View file @
f58c73b7
...
@@ -42,5 +42,9 @@ dependencies {
...
@@ -42,5 +42,9 @@ dependencies {
compile
'com.github.michalis-vitos:aFileChooser:master'
compile
'com.github.michalis-vitos:aFileChooser:master'
compile
'com.google.code.gson:gson:2.8.0'
compile
'com.google.code.gson:gson:2.8.0'
compile
'com.github.clans:fab:1.6.4'
compile
'com.github.clans:fab:1.6.4'
compile
'com.madgag.spongycastle:core:1.54.0.0'
compile
'com.madgag.spongycastle:prov:1.54.0.0'
compile
'com.madgag.spongycastle:pkix:1.54.0.0'
compile
'com.madgag.spongycastle:pg:1.54.0.0'
annotationProcessor
'com.jakewharton:butterknife-compiler:8.4.0'
annotationProcessor
'com.jakewharton:butterknife-compiler:8.4.0'
}
}
app/src/main/assets/private.key.pk8
0 → 100644
View file @
f58c73b7
File added
app/src/main/assets/public.certificate.x509.pem
0 → 100644
View file @
f58c73b7
-----BEGIN CERTIFICATE-----
MIIEqDCCA5CgAwIBAgIJAJNurL4H8gHfMA0GCSqGSIb3DQEBBQUAMIGUMQswCQYD
VQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4g
VmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UE
AxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAe
Fw0wODAyMjkwMTMzNDZaFw0zNTA3MTcwMTMzNDZaMIGUMQswCQYDVQQGEwJVUzET
MBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4G
A1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9p
ZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZI
hvcNAQEBBQADggENADCCAQgCggEBANaTGQTexgskse3HYuDZ2CU+Ps1s6x3i/waM
qOi8qM1r03hupwqnbOYOuw+ZNVn/2T53qUPn6D1LZLjk/qLT5lbx4meoG7+yMLV4
wgRDvkxyGLhG9SEVhvA4oU6Jwr44f46+z4/Kw9oe4zDJ6pPQp8PcSvNQIg1QCAcy
4ICXF+5qBTNZ5qaU7Cyz8oSgpGbIepTYOzEJOmc3Li9kEsBubULxWBjf/gOBzAzU
RNps3cO4JFgZSAGzJWQTT7/emMkod0jb9WdqVA2BVMi7yge54kdVMxHEa5r3b97s
zI5p58ii0I54JiCUP5lyfTwE/nKZHZnfm644oLIXf6MdW2r+6R8CAQOjgfwwgfkw
HQYDVR0OBBYEFEhZAFY9JyxGrhGGBaR0GawJyowRMIHJBgNVHSMEgcEwgb6AFEhZ
AFY9JyxGrhGGBaR0GawJyowRoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UE
CBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMH
QW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAG
CSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJAJNurL4H8gHfMAwGA1Ud
EwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAHqvlozrUMRBBVEY0NqrrwFbinZa
J6cVosK0TyIUFf/azgMJWr+kLfcHCHJsIGnlw27drgQAvilFLAhLwn62oX6snb4Y
LCBOsVMR9FXYJLZW2+TcIkCRLXWG/oiVHQGo/rWuWkJgU134NDEFJCJGjDbiLCpe
+ZTWHdcwauTJ9pUbo8EvHRkU3cYfGmLaLfgn9gP+pWA7LFQNvXwBnDa6sppCccEX
31I828XzgXpJ4O+mDL1/dBd+ek8ZPUP0IgdyZm5MTYPhvVqGCHzzTy3sIeJFymwr
sBbmg2OAUNLEMO6nwmocSdN2ClirfxqCzJOLSDE4QyS9BAH6EhY6UFcOaE0=
-----END CERTIFICATE-----
app/src/main/java/com/topjohnwu/magisk/adapters/ReposAdapter.java
View file @
f58c73b7
...
@@ -27,9 +27,11 @@ import com.topjohnwu.magisk.utils.Utils;
...
@@ -27,9 +27,11 @@ import com.topjohnwu.magisk.utils.Utils;
import
com.topjohnwu.magisk.utils.WebWindow
;
import
com.topjohnwu.magisk.utils.WebWindow
;
import
com.topjohnwu.magisk.utils.ZipUtils
;
import
com.topjohnwu.magisk.utils.ZipUtils
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.util.List
;
import
java.util.List
;
import
butterknife.BindView
;
import
butterknife.BindView
;
...
@@ -104,14 +106,36 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
...
@@ -104,14 +106,36 @@ public class ReposAdapter extends RecyclerView.Adapter<ReposAdapter.ViewHolder>
new
DownloadReceiver
()
{
new
DownloadReceiver
()
{
@Override
@Override
public
void
task
(
Uri
uri
)
{
public
void
task
(
Uri
uri
)
{
// Process and sign the zip
try
{
try
{
ByteArrayOutputStream
buffer
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
outBuffer
=
new
ByteArrayOutputStream
();
InputStream
in
=
mContext
.
getContentResolver
().
openInputStream
(
uri
);
ByteArrayInputStream
inBuffer
;
ZipUtils
.
removeTopFolder
(
in
,
buffer
);
buffer
.
writeTo
(
mContext
.
getContentResolver
().
openOutputStream
(
uri
));
// First remove top folder (the folder with the repo name) in Github source zip
ZipUtils
.
removeTopFolder
(
mContext
.
getContentResolver
().
openInputStream
(
uri
),
outBuffer
);
inBuffer
=
new
ByteArrayInputStream
(
outBuffer
.
toByteArray
().
clone
());
outBuffer
.
reset
();
// Then sign the zip for the first time
ZipUtils
.
signZip
(
mContext
,
inBuffer
,
outBuffer
,
false
);
inBuffer
=
new
ByteArrayInputStream
(
outBuffer
.
toByteArray
().
clone
());
outBuffer
.
reset
();
// ZipAdjust to be placed here
// Call JNI for zipadjust...
// Finally, sign the whole zip file again
ZipUtils
.
signZip
(
mContext
,
inBuffer
,
outBuffer
,
true
);
// Write it back to the downloaded zip
OutputStream
out
=
mContext
.
getContentResolver
().
openOutputStream
(
uri
);
outBuffer
.
writeTo
(
out
);
out
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
return
;
return
;
}
}
// Flash the zip
new
Async
.
FlashZIP
(
mContext
,
uri
,
mFilename
).
exec
();
new
Async
.
FlashZIP
(
mContext
,
uri
,
mFilename
).
exec
();
}
}
},
},
...
...
app/src/main/java/com/topjohnwu/magisk/utils/ZipUtils.java
View file @
f58c73b7
This diff is collapsed.
Click to expand it.
gradle.properties
View file @
f58c73b7
...
@@ -10,9 +10,9 @@
...
@@ -10,9 +10,9 @@
# Specifies the JVM arguments used for the daemon process.
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512
m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.jvmargs
=
-Xmx4096m -XX:MaxPermSize=4096
m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
#
org.gradle.parallel
=
true
org.gradle.parallel
=
true
\ No newline at end of file
\ No newline at end of file
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