method_id = (*env)->GetMethodID(env,
android_charonvpnservice_class,
- "getTrustedCertificates", "(Ljava/lang/String;)[[B");
+ "getTrustedCertificates", "()[[B");
if (!method_id)
{
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))
{
goto failed;
* Function called via JNI to generate a list of DER encoded CA certificates
* as byte array.
*
- * @param hash optional alias (only hash part), if given matching certificates are returned
* @return a list of DER encoded CA certificates
*/
- private byte[][] getTrustedCertificates(String hash)
+ private byte[][] getTrustedCertificates()
{
ArrayList<byte[]> certs = new ArrayList<byte[]>();
TrustedCertificateManager certman = TrustedCertificateManager.getInstance();
try
{
- if (hash != null)
+ String alias = this.mCurrentCertificateAlias;
+ if (alias != 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;
- if (alias != null)
+ for (X509Certificate cert : certman.getAllCACertificates().values())
{
- X509Certificate cert = certman.getCACertificateFromAlias(alias);
- if (cert == null)
- {
- return null;
- }
certs.add(cert.getEncoded());
}
- else
- {
- for (X509Certificate cert : certman.getAllCACertificates().values())
- {
- certs.add(cert.getEncoded());
- }
- }
}
}
catch (CertificateEncodingException e)