After reading the content of this chapter, I feel that some of them are very familiar, because Android signature authentication is based on the Java mechanism. Signature and authentication process
The encryption and decryption processes and principles of public and private keys need to be further studied. An example of signature and authentication is as follows:
1. Write doer Inherited Characters for classes like friend and stranger
2. Pack friend and stranger into jar packages respectively.
Jar CVF friend. Jar COM/artima/security/friend/*. classjar CVF stranger. Jar COM/artima/security/stranger/*. Class
3. generate two key pairs
Keytool-genkey-alias friend-keypass friend4life-validity 10000-keystore ijvmkeyskeytool-genkey-alias stranger-keypass stranger4life-validity 10000-keystore ijvmkeys
The two passwords must be consistent. Because you need to access the keystore when adding the key for the second time, you need to set the password for the first time.
4. Use jarsigner to sign
Jarsigner-keystore ijvmkeys-storepass ijvm2ed-keypass friend4life friend. Jar friendjarsigner-keystore ijvmkeys-storepass ijvm2ed-keypass stranger4life stranger. Jar stranger
After the signed JAR package is modified, running the jar package reports a java. Lang. securityexception exception.