资源简介
将修改好的ROM 复制到【SignApkV2】文件夹下,运行【SignerScript.bat】
得到的【update_signed.zip】 就是签名好的ROM
改名【update.zip】复制到U盘就可以刷机了!
PS:如果系统隐藏了扩展名就省去.zip
代码片段和文件信息
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License Version 2.0 (the “License“);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.signapk;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.RandomAccessFile;
import java.security.DigestOutputStream;
import java.security.GeneralSecurityException;
import java.security.Key;
import java.security.KeyFactory;
import java.security.MessageDigest;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.KeySpec;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import java.util.regex.Pattern;
import javax.crypto.Cipher;
import javax.crypto.EncryptedPrivateKeyInfo;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import sun.misc.base64Encoder;
import sun.security.pkcs.ContentInfo;
import sun.security.pkcs.PKCS7;
import sun.security.pkcs.SignerInfo;
import sun.security.x509.AlgorithmId;
import sun.security.x509.X500Name;
/**
* Command line tool to sign JAR files (including APKs and OTA updates) in
* a way compatible with the mincrypt verifier using SHA1 and RSA keys.
*/
class SignApk {
private static final String CERT_SF_NAME = “meta-INF/CERT.SF“;
private static final String CERT_RSA_NAME = “meta-INF/CERT.RSA“;
private static boolean VerboseMode = false;
// Files matching this pattern are not copied to the output.
private static Pattern stripPattern =
Pattern.compile(“^meta-INF/(.*)[.](SF|RSA|DSA)$“);
private static X509Certificate readPublicKey(File file)
th
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 9945 2012-12-21 14:21 SignApkv2.jar
文件 87 2012-05-21 03:36 Signersc
文件 23860 2012-12-21 14:13 SignApkv2.java
文件 1217 2008-11-05 15:17 testkey.pk8
文件 1675 2008-11-05 15:17 testkey.x509.pem
----------- --------- ---------- ----- ----
36784 5
- 上一篇:一步步教你移植FatFS文件系统
- 下一篇:GUI界面-绘制不同的曲线
评论
共有 条评论