(Context context)
| 99 | } |
| 100 | |
| 101 | static KeyStore getCAStore(Context context) throws KeyStoreException, CertificateException, IOException, NoSuchAlgorithmException { |
| 102 | KeyStore aks = KeyStore.getInstance("AndroidCAStore"); |
| 103 | aks.load(null, null); |
| 104 | |
| 105 | KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); |
| 106 | ks.load(null, null); |
| 107 | |
| 108 | Enumeration<String> aliases = aks.aliases(); |
| 109 | while (aliases.hasMoreElements()) { |
| 110 | String alias = aliases.nextElement(); |
| 111 | if (aks.isCertificateEntry(alias)) |
| 112 | ks.setCertificateEntry(alias, aks.getCertificate(alias)); |
| 113 | } |
| 114 | |
| 115 | int idx = 1; |
| 116 | for (X509Certificate ca : SmimeHelper.readCACertificates(context)) { |
| 117 | String alias = "asset:" + idx++ + ":" + ca.getSubjectDN().getName(); |
| 118 | ks.setCertificateEntry(alias, ca); |
| 119 | } |
| 120 | |
| 121 | return ks; |
| 122 | } |
| 123 | } |
no test coverage detected