@Test public void testGetCertificateInfos() throws Exception { String path = "/home/lai/Work/360卫士.apk"; System.out.println(CertTool.getCertificateInfos(new File(path))); }
public static HashMap<String, String> getCertificateInfos(File file) { Certificate[] certs; HashMap<String, String> hashMap = new HashMap<>(); try { certs = getCertificates(file); for (Certificate cert : certs) { hashMap.put(getCertMd5(cert), getCertSubject(cert)); } } catch (NullPointerException e) { return hashMap; } catch (IOException e) { e.printStackTrace(); } return hashMap; }
CertTool { public static HashMap<String, String> getCertificateInfos(File file) { Certificate[] certs; HashMap<String, String> hashMap = new HashMap<>(); try { certs = getCertificates(file); for (Certificate cert : certs) { hashMap.put(getCertMd5(cert), getCertSubject(cert)); } } catch (NullPointerException e) { return hashMap; } catch (IOException e) { e.printStackTrace(); } return hashMap; } }
CertTool { public static HashMap<String, String> getCertificateInfos(File file) { Certificate[] certs; HashMap<String, String> hashMap = new HashMap<>(); try { certs = getCertificates(file); for (Certificate cert : certs) { hashMap.put(getCertMd5(cert), getCertSubject(cert)); } } catch (NullPointerException e) { return hashMap; } catch (IOException e) { e.printStackTrace(); } return hashMap; }  }
CertTool { public static HashMap<String, String> getCertificateInfos(File file) { Certificate[] certs; HashMap<String, String> hashMap = new HashMap<>(); try { certs = getCertificates(file); for (Certificate cert : certs) { hashMap.put(getCertMd5(cert), getCertSubject(cert)); } } catch (NullPointerException e) { return hashMap; } catch (IOException e) { e.printStackTrace(); } return hashMap; }  static String getCertMd5(Certificate cert); static HashMap<String, String> getCertificateInfos(File file); static HashMap<String, String> getCertificateInfos(InputStream inputStream); static HashMap<String, String> getCertificateInfos(byte[] bytes); static String getCertSubject(Certificate cert); static String getCertDetail(Certificate cert); }
CertTool { public static HashMap<String, String> getCertificateInfos(File file) { Certificate[] certs; HashMap<String, String> hashMap = new HashMap<>(); try { certs = getCertificates(file); for (Certificate cert : certs) { hashMap.put(getCertMd5(cert), getCertSubject(cert)); } } catch (NullPointerException e) { return hashMap; } catch (IOException e) { e.printStackTrace(); } return hashMap; }  static String getCertMd5(Certificate cert); static HashMap<String, String> getCertificateInfos(File file); static HashMap<String, String> getCertificateInfos(InputStream inputStream); static HashMap<String, String> getCertificateInfos(byte[] bytes); static String getCertSubject(Certificate cert); static String getCertDetail(Certificate cert);  }