android: Remove unused hash argument from getTrustedCertificates()

This commit is contained in:
Tobias Brunner
2014-07-22 10:41:48 +02:00
parent b9fd95f476
commit 9d994ba5ea
2 changed files with 6 additions and 25 deletions
@@ -299,12 +299,12 @@ METHOD(charonservice_t, get_trusted_certificates, linked_list_t*,
method_id = (*env)->GetMethodID(env, method_id = (*env)->GetMethodID(env,
android_charonvpnservice_class, android_charonvpnservice_class,
"getTrustedCertificates", "(Ljava/lang/String;)[[B"); "getTrustedCertificates", "()[[B");
if (!method_id) if (!method_id)
{ {
goto failed; goto failed;
} }
jcerts = (*env)->CallObjectMethod(env, this->vpn_service, method_id, NULL); jcerts = (*env)->CallObjectMethod(env, this->vpn_service, method_id);
if (!jcerts || androidjni_exception_occurred(env)) if (!jcerts || androidjni_exception_occurred(env))
{ {
goto failed; goto failed;
@@ -419,31 +419,13 @@ public class CharonVpnService extends VpnService implements Runnable
* Function called via JNI to generate a list of DER encoded CA certificates * Function called via JNI to generate a list of DER encoded CA certificates
* as byte array. * as byte array.
* *
* @param hash optional alias (only hash part), if given matching certificates are returned
* @return a list of DER encoded CA certificates * @return a list of DER encoded CA certificates
*/ */
private byte[][] getTrustedCertificates(String hash) private byte[][] getTrustedCertificates()
{ {
ArrayList<byte[]> certs = new ArrayList<byte[]>(); ArrayList<byte[]> certs = new ArrayList<byte[]>();
TrustedCertificateManager certman = TrustedCertificateManager.getInstance(); TrustedCertificateManager certman = TrustedCertificateManager.getInstance();
try try
{
if (hash != null)
{
String alias = "user:" + hash + ".0";
X509Certificate cert = certman.getCACertificateFromAlias(alias);
if (cert == null)
{
alias = "system:" + hash + ".0";
cert = certman.getCACertificateFromAlias(alias);
}
if (cert == null)
{
return null;
}
certs.add(cert.getEncoded());
}
else
{ {
String alias = this.mCurrentCertificateAlias; String alias = this.mCurrentCertificateAlias;
if (alias != null) if (alias != null)
@@ -463,7 +445,6 @@ public class CharonVpnService extends VpnService implements Runnable
} }
} }
} }
}
catch (CertificateEncodingException e) catch (CertificateEncodingException e)
{ {
e.printStackTrace(); e.printStackTrace();