Android 中的签名机制 '/C=CN/ST=ShanDao/L=QingDao/O=Haier/OU=Haier/CN=Haier/emailAddress=Haier'时请注明出处和作者联系方式文章出处:.limodev.cn/blog作者联系方式:先静 昨天看了一下 Android 中的签名机制,这里介绍一下 Android 中签名用的 Key 的产生方法和签名的原理。产生 Keyo 产生 RSA 私钥(private key)openssl genrsa -3 -out testkey.pem 2048-3 是算法的参数(public exponent)。2048 是私钥长度。testkey.pem 是输出的文件。o 产生 PKCS#10 格式的认证请求。所谓认证请求就是发给认证机构认证的一个请求,它主要包括一个公钥和一些相关信息(如组织名称和联系人地址)。openssl req -new -x509 -key testkey.pem -out testkey.x509.pem -days 10000 /-subj ‘/C=US/ST=California/L=Mountain View/O=Android/OU=Android/CN=Android/emailAddress=androidandroid.’假如不提供最后两个参数,openssl 会提示你输入相关信息,这里的信息可以根据你自己的实际情况填写。如:openssl req -new -x509 -key testkey.pem -out testkey.x509.pem -days 10000You are about to be asked to enter information that will be incorporatedinto your certificate request.What you are about to enter is what is called a Distinguished Name or a DN.There are quite a few fields but you can leave some blankFor some fields there will be a default value,If you enter ‘.’, the field will be left blank.—–Country Name (2 letter code) [GB]:CNState or Province Name (full name) [Berkshire]:GuangDongLocality Name (eg, city) [Newbury]:ShenZhenOrganization Name (eg, company) [My Company Ltd]:TopwiseOrganizational Unit Name (eg, section) []:BronchoCommon Name (eg, your name or your server’s hostname) []:broncho.cnEmail Address []:bronchosalesgmail.o 把私钥的格式转换成 PKCS #8(Private-Key Information Syntax Standard.)openssl pkcs8 -in testkey.pem -topk8 -outform DER -out testkey.pk8 -nocrypt私钥是不能让别人知道的,否则就起不到的作用了。私钥通常是要加密保存的,但这里指定了-noc...