MCPcopy Create free account
hub / github.com/M66B/FairEmail / getCAStore

Method getCAStore

app/src/main/java/eu/faircode/email/SmimeHelper.java:101–122  ·  view source on GitHub ↗
(Context context)

Source from the content-addressed store, hash-verified

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}

Callers 2

onExecuteMethod · 0.95
onExecuteMethod · 0.95

Calls 7

readCACertificatesMethod · 0.95
loadMethod · 0.65
getCertificateMethod · 0.65
getNameMethod · 0.65
getInstanceMethod · 0.45
hasMoreElementsMethod · 0.45
nextElementMethod · 0.45

Tested by

no test coverage detected