• <noscript id="ggggg"><dd id="ggggg"></dd></noscript>
    <small id="ggggg"></small> <sup id="ggggg"></sup>
    <noscript id="ggggg"><dd id="ggggg"></dd></noscript>
    <tfoot id="ggggg"></tfoot>
  • <nav id="ggggg"><cite id="ggggg"></cite></nav>
    <nav id="ggggg"></nav>
    成人黃色A片免费看三更小说,精品人妻av区波多野结衣,亚洲第一极品精品无码,欧美综合区自拍亚洲综合,久久99青青精品免费观看,中文字幕在线中字日韩 ,亚洲国产精品18久久久久久,黄色在线免费观看

    Android 獲取應(yīng)用 MD5 SHA1 SHA256 簽名信息

    2020-2-8    seo達(dá)人

    閑著沒事兒寫了個(gè)小 demo ,獲取手機(jī)上已安裝應(yīng)用信息,系統(tǒng)應(yīng)用和 非系統(tǒng)應(yīng)用

    MD5 SHA1 SHA256 簽名信息 點(diǎn)擊簽名信息可復(fù)制到剪切板,

    GitHub:https://github.com/sunan-n/GetAppInfo

    如下圖:






    
    <span style="white-space:pre;"> </span>主要就是這個(gè)方法,傳參數(shù)進(jìn)來獲取相應(yīng)的簽名類型 信息<br />
    &nbsp; &nbsp; public static String getSignaturesInfo(Context context, String packageName, String tpye) {<br />
    //&nbsp; &nbsp; &nbsp; &nbsp; //獲取包管理器<br />
    &nbsp; &nbsp; &nbsp; &nbsp; PackageManager pm = context.getPackageManager();<br />
    &nbsp; &nbsp; &nbsp; &nbsp; //返回包括在包中的簽名信息<br />
    &nbsp; &nbsp; &nbsp; &nbsp; int flags = PackageManager.GET_SIGNATURES;<br />
    &nbsp; &nbsp; &nbsp; &nbsp; PackageInfo packageInfo = null;<br />
    &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //獲得包的所有內(nèi)容信息類<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; packageInfo = pm.getPackageInfo(packageName, flags);<br />
    &nbsp; &nbsp; &nbsp; &nbsp; } catch (PackageManager.NameNotFoundException e) {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
    &nbsp; &nbsp; &nbsp; &nbsp; }<br />
    &nbsp; &nbsp; &nbsp; &nbsp; //簽名信息<br />
    &nbsp; &nbsp; &nbsp; &nbsp; Signature[] signatures = packageInfo.signatures;<br />
    &nbsp; &nbsp; &nbsp; &nbsp; byte[] cert = signatures[0].toByteArray();<br />
    &nbsp; &nbsp; &nbsp; &nbsp; //將簽名轉(zhuǎn)換為字節(jié)數(shù)組流<br />
    &nbsp; &nbsp; &nbsp; &nbsp; InputStream input = new ByteArrayInputStream(cert);<br />
    &nbsp; &nbsp; &nbsp; &nbsp; //證書工廠類,這個(gè)類實(shí)現(xiàn)了出廠合格證算法的功能<br />
    &nbsp; &nbsp; &nbsp; &nbsp; CertificateFactory cf = null;<br />
    &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cf = CertificateFactory.getInstance("X509");<br />
    &nbsp; &nbsp; &nbsp; &nbsp; } catch (CertificateException e) {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
    &nbsp; &nbsp; &nbsp; &nbsp; }<br />
    &nbsp; &nbsp; &nbsp; &nbsp; //X509證書,X.509是一種非常通用的證書格式<br />
    &nbsp; &nbsp; &nbsp; &nbsp; X509Certificate c = null;<br />
    &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; c = (X509Certificate) cf.generateCertificate(input);<br />
    &nbsp; &nbsp; &nbsp; &nbsp; } catch (CertificateException e) {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
    &nbsp; &nbsp; &nbsp; &nbsp; }<br />
    &nbsp; &nbsp; &nbsp; &nbsp; String hexString = null;<br />
    &nbsp; &nbsp; &nbsp; &nbsp; try {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //加密算法的類,這里的參數(shù)可以使MD4,MD5等加密算法<br />
    //&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageDigest md = MessageDigest.getInstance("SHA1");<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MessageDigest md = MessageDigest.getInstance(tpye);<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //獲得公鑰<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; byte[] publicKey = md.digest(c.getEncoded());<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //字節(jié)到十六進(jìn)制的格式轉(zhuǎn)換<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; hexString = byte2HexFormatted(publicKey);<br />
    &nbsp; &nbsp; &nbsp; &nbsp; } catch (NoSuchAlgorithmException e1) {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e1.printStackTrace();<br />
    &nbsp; &nbsp; &nbsp; &nbsp; } catch (CertificateEncodingException e) {<br />
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace();<br />
    &nbsp; &nbsp; &nbsp; &nbsp; }<br />
    &nbsp; &nbsp; &nbsp; &nbsp; return hexString;<br />
    &nbsp; &nbsp; }<br />
    <br />

    日歷

    鏈接

    個(gè)人資料

    存檔

    主站蜘蛛池模板: 中国产无码一区二区三区| www.99精品视频在线播放| 久久99久久99精品免视看| 亚洲精品午夜天堂网页| 图片区偷拍区小说区五月| 国产午夜人做人免费视频| 四虎跳转到新域名| 日韩福利影院| 人人澡人人草| 欧美人与动交片免费播放| 人妻无码一区二区三区免费| 五月婷婷色综合| 夜夜躁狠狠躁2021| 国产国拍亚洲精品永久69| 日韩一区中文免费视频| 看你懂的巨臀中文字幕一区二区| 欧美亚洲国产精品久久久久| 中文字幕一精品亚洲无线一区| 久久99精品久久久久久HB | 成人性爱影院| 麻豆AⅤ精品无码一区二区 | 人妻丰满熟妇AV无码区APP| 偷青青国产精品青青在线观看| 91国语对白爽死我了| 2021国产v亚洲v天堂无码| 99在线精品偷拍视频| 国产一区二区三区av在线无码观看| av高清无码国产在线观看| freesexparty性欧美第一次| 国产午夜精品一区二区三区不| 好爽好硬好深高潮视频456| 日韩不卡在线观看视频不卡 | 亚洲精品二三区伊人久久| 九九热精品在线观看| 男人把女人桶到爽爆的视频| 人人爽人人澡人人高潮| a国产成人免费视频| 国产一区二区精品网站看黄| 亚洲AV无码一区二区三区东京热| 国产精品天干在线观看| 贵阳市|