File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed
lib/src/main/java/at/bitfire/cert4android Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -132,22 +132,26 @@ class CustomCertStore internal constructor(
132132
133133 @Synchronized
134134 fun setTrustedByUser (cert : X509Certificate ) {
135- val tag = CertUtils .getTag(cert)
136- Cert4Android .log.info(" Trusted by user: ${cert.subjectDN.name} ($tag )" )
135+ val alias = CertUtils .getTag(cert)
136+ Cert4Android .log.info(" Trusted by user: ${cert.subjectDN.name} ($alias )" )
137137
138- userKeyStore.setCertificateEntry(tag , cert)
138+ userKeyStore.setCertificateEntry(alias , cert)
139139 saveUserKeyStore()
140140
141141 untrustedCerts - = cert
142142 }
143143
144144 @Synchronized
145145 fun setUntrustedByUser (cert : X509Certificate ) {
146- val tag = CertUtils .getTag(cert)
147- Cert4Android .log.info(" Distrusted by user: ${cert.subjectDN.name} ($tag )" )
146+ Cert4Android .log.info(" Distrusted by user: ${cert.subjectDN.name} " )
148147
149- userKeyStore.deleteEntry(tag)
150- saveUserKeyStore()
148+ // find certificate
149+ val alias = userKeyStore.getCertificateAlias(cert)
150+ if (alias != null ) {
151+ // and delete, if applicable
152+ userKeyStore.deleteEntry(alias)
153+ saveUserKeyStore()
154+ }
151155
152156 untrustedCerts + = cert
153157 }
You can’t perform that action at this time.
0 commit comments