View apk Signature

Source: Internet
Author: User
Tags certificate fingerprint

Write a script to view the apk signature using shell. Very few and very simple codes

#! /Bin/bash
Mypath = 'pwd'
Filepath = ""
Mkdir. temp_for_certificate
Cd. temp_for_certificate
Count = 0
While [-n "$1"]
Do
Count = $ [$ count + 1]
Echo "(# $ count)" 'basename "$1 "'":"
If ['expr substr "$1" 1 1' = "/"] # absolute path
Then
Filepath = "$1"
Else # Relative Path
Filepath = "$ mypath/$1"
Fi
Path = 'jar tf "$ filepath" | grep RSA '# Find the RSA file in the apk.
Jar xf $ filepath $ path # decompress the RSA File
Keytool-printcert-file $ path # view fingerprint Certificate
Rm-r $ path # Delete the decompressed File
Echo "--------------------------------------------"
Shift
Done
Cd ..
Rm-r. temp_for_certificate (save it to a file and name it getcertificate)

 

Usage:

Getcertificate Superuser.apk Skype3.0.apk output:

(#1) Superuser.apk:

Owner: CN = Adam Shanks, OU = Android, O = SoupCoconut, L = FWB, ST = Florida, C = US
Issuer: CN = Adam Shanks, OU = Android, O = SoupCoconut, L = FWB, ST = Florida, C = US
Serial number: 4c614057
Validity Period: Tue Aug 10 20:04:39 CST 2010 to Sat Dec 26 20:04:39 CST 2037
Certificate fingerprint:
MD5: D2: 42: 30: AA: BE: 81: 62: 30: FE: B4: 0E: F1: CF: 11: B0: C0
SHA1: 5F: 11: 3F: C2: C2: 0A: 7C: 9B: D9: 28: 19: 22: 6A: 32: A1: 90: 4B: 75: EF: 8B
Signature algorithm name: SHA1withRSA
Version: 3
--------------------------------------------
(#2) Skype3.0.apk:

Owner: CN = Skype, OU = Mobile Client, O = Skype, L = London, C = GB
Issuer: CN = Skype, OU = Mobile Client, O = Skype, L = London, C = GB
Serial number: 4c0e1962
Validity Period: Tue Jun 08 18:20:18 CST 2010 to Fri Jul 20 18:20:18 CST 2040
Certificate fingerprint:
MD5: 37: 5F: 1A: 56: C5: 2A: 51: FF: 35: F3: 6C: C5: A6: 69: 54: EC
SHA1: 77: 18: 07: D1: B8: 41: 4D: 69: 89: E7: D8: EF: 0B: 97: 97: 24: 3B: 93: 1F: 95
Signature algorithm name: SHA1withRSA
Version: 3
--------------------------------------------
 

You can also use jarsigner to view the signature.

Jarsigner-verify-verbose-certs Superuser.apk jarsigner detailed usage refer to help

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.