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
97cf1500
Commit
97cf1500
authored
Jan 22, 2018
by
topjohnwu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update crypto
parent
e8302dfb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
11 deletions
+9
-11
app
app
+1
-1
SignAPK.java
crypto/src/main/java/com/topjohnwu/crypto/SignAPK.java
+3
-8
ZipSigner.java
crypto/src/main/java/com/topjohnwu/crypto/ZipSigner.java
+5
-2
No files found.
app
@
00d655f3
Subproject commit
759e905c3c61018ae736e313d0272e215086f6e2
Subproject commit
00d655f346fe6182d508d76d6b75d8e7357fcb9d
crypto/src/main/java/com/topjohnwu/crypto/SignAPK.java
View file @
97cf1500
...
...
@@ -70,9 +70,8 @@ public class SignAPK {
}
public
static
void
signZip
(
InputStream
publicIn
,
InputStream
privateIn
,
JarMap
input
,
File
output
,
boolean
minSign
)
throws
Exception
{
JarMap
input
,
OutputStream
output
,
boolean
minSign
)
throws
Exception
{
int
alignment
=
4
;
BufferedOutputStream
outputFile
;
int
hashes
=
0
;
X509Certificate
publicKey
=
CryptoUtils
.
readPublicKey
(
publicIn
);
hashes
|=
getDigestAlgorithm
(
publicKey
);
...
...
@@ -83,11 +82,10 @@ public class SignAPK {
long
timestamp
=
publicKey
.
getNotBefore
().
getTime
()
+
3600L
*
1000
;
PrivateKey
privateKey
=
CryptoUtils
.
readPrivateKey
(
privateIn
);
outputFile
=
new
BufferedOutputStream
(
new
FileOutputStream
(
output
));
if
(
minSign
)
{
signWholeFile
(
input
.
getFile
(),
publicKey
,
privateKey
,
output
File
);
signWholeFile
(
input
.
getFile
(),
publicKey
,
privateKey
,
output
);
}
else
{
JarOutputStream
outputJar
=
new
JarOutputStream
(
output
File
);
JarOutputStream
outputJar
=
new
JarOutputStream
(
output
);
// For signing .apks, use the maximum compression to make
// them as small as possible (since they live forever on
// the system partition). For OTA packages, use the
...
...
@@ -98,10 +96,7 @@ public class SignAPK {
Manifest
manifest
=
addDigestsToManifest
(
input
,
hashes
);
copyFiles
(
manifest
,
input
,
outputJar
,
timestamp
,
alignment
);
signFile
(
manifest
,
input
,
publicKey
,
privateKey
,
outputJar
);
outputJar
.
close
();
}
input
.
close
();
outputFile
.
close
();
}
/**
...
...
crypto/src/main/java/com/topjohnwu/crypto/ZipSigner.java
View file @
97cf1500
...
...
@@ -2,8 +2,10 @@ package com.topjohnwu.crypto;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
java.io.BufferedOutputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.security.Security
;
...
...
@@ -32,8 +34,9 @@ public class ZipSigner {
try
(
InputStream
pub
=
new
FileInputStream
(
pubKey
);
InputStream
priv
=
new
FileInputStream
(
privKey
);
JarMap
jar
=
new
JarMap
(
input
,
false
))
{
SignAPK
.
signZip
(
pub
,
priv
,
jar
,
output
,
minSign
);
JarMap
jar
=
new
JarMap
(
input
,
false
);
BufferedOutputStream
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
output
)))
{
SignAPK
.
signZip
(
pub
,
priv
,
jar
,
out
,
minSign
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
exit
(
1
);
...
...
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