1
0
mirror of https://github.com/owncloud/android-library.git synced 2025-06-07 16:06:08 +00:00

OC-3163: Check if the certificate is in the app cetificates repository (mKnownServers of NetworkUtils)

This commit is contained in:
masensio 2014-03-05 12:15:07 +01:00
parent cd4414a7bd
commit b274963153

View File

@ -172,5 +172,12 @@ public class NetworkUtils {
return mConnManager;
}
public static boolean isCertInKnownServersStore(Certificate cert, Context context) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
KeyStore knownServers = getKnownServersStore(context);
Log.d(TAG, "Certificate - HashCode: " + cert.hashCode() + " "
+ Boolean.toString(knownServers.isCertificateEntry(Integer.toString(cert.hashCode()))));
return knownServers.isCertificateEntry(Integer.toString(cert.hashCode()));
}
}