资源简介
rom签名工具
代码片段和文件信息
/*
* 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
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-07-09 21:17 SignApkV2\
文件 9945 2012-12-21 14:21 SignApkV2\SignApkv2.jar
文件 23860 2012-12-21 14:13 SignApkV2\SignApkv2.java
文件 82 2013-07-09 21:11 SignApkV2\Signersc
文件 1217 2008-11-05 15:17 SignApkV2\testkey.pk8
文件 1675 2008-11-05 15:17 SignApkV2\testkey.x509.pem
文件 283 2013-11-19 11:23 说明.txt
- 上一篇:饿了么,百度,美团外卖,订餐系统源码
- 下一篇:VMwareP2V迁移工具介绍
评论
共有 条评论