1.shell脚本的编写(mkkey.sh):
#!/bin/bash
country=China
province=Guangdong
city=Shenzhen
company=ELINK
section=Android
name=weicaihui2008
email=weicaihui2008@163.com
AUTH='/C=$country/ST=$province/L=$city View/O=$company/OU=$section/CN=$name/emailAddress=$email'
if [[ $# -lt 1 ]]; then
echo "Create a test certificate key."
echo "Usage: $0 NAME"
echo "Will generate NAME.pk8 and NAME.x509.pem"
echo "eg: $AUTH"
echo "Note:"
echo " C ---> Country Name (2 letter code)"
echo " ST ---> State or Province Name (full name)"
echo " L ---> Locality Name (eg, city)"
echo " O ---> Organization Name (eg, company)"
echo " OU ---> Organizational Unit Name (eg, section)"
echo " CN ---> Common Name (eg, your name or your server’s hostname)"
echo " emailAddress ---> Contact email address"
exit
elif [[ $# -gt 1 ]]; then
AUTH=$2
fi
openssl genrsa -3 -out $1.pem 2048
openssl req -new -x509 -key $1.pem -out $1.x509.pem -days 10000 \
-subj "$AUTH"
echo "Please enter the password for this key:"
openssl pkcs8 -in $1.pem -topk8 -outform DER -out $1.pk8 -passout stdin
2.要生成签名文件:
platform. Key for packages that are part of the core platform.
shared. Key for things that are shared in the home/contacts process.*
media. Key for packages that are part of the media/download system.
releasekey. Default key to sign with if not otherwise specified
3.如何生成:
./mkkey.sh 参数1 参数2
参数1: 生成的签名文件名称
参数2:证书配置信息,可以不要这个参数,使用默认,帮助直接运行脚本