Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ebb61ca2 authored by Kenny Root's avatar Kenny Root Committed by Gerrit Code Review
Browse files

Merge "Track libcore changes for OpenSSLKey"

parents bf043b50 cc1fc6b6
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -56,8 +56,8 @@ import java.util.Map;
import java.util.Set;

import org.apache.harmony.security.provider.cert.X509CertImpl;
import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey;
import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey;
import org.apache.harmony.xnet.provider.jsse.OpenSSLKey;
import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder;

class BrowserFrame extends Handler {

@@ -1129,13 +1129,10 @@ class BrowserFrame extends Handler {
        if (table.IsAllowed(hostAndPort)) {
            // previously allowed
            PrivateKey pkey = table.PrivateKey(hostAndPort);
            if (pkey instanceof OpenSSLRSAPrivateKey) {
            if (pkey instanceof OpenSSLKeyHolder) {
                OpenSSLKey sslKey = ((OpenSSLKeyHolder) pkey).getOpenSSLKey();
                nativeSslClientCert(handle,
                                    ((OpenSSLRSAPrivateKey)pkey).getPkeyContext(),
                                    table.CertificateChain(hostAndPort));
            } else if (pkey instanceof OpenSSLDSAPrivateKey) {
                nativeSslClientCert(handle,
                                    ((OpenSSLDSAPrivateKey)pkey).getPkeyContext(),
                                    sslKey.getPkeyContext(),
                                    table.CertificateChain(hostAndPort));
            } else {
                nativeSslClientCert(handle,
+6 −9
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ import java.security.PrivateKey;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;
import org.apache.harmony.xnet.provider.jsse.NativeCrypto;
import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey;
import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey;
import org.apache.harmony.xnet.provider.jsse.OpenSSLKey;
import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder;

/**
 * ClientCertRequestHandler: class responsible for handling client
@@ -56,12 +56,9 @@ public final class ClientCertRequestHandler extends Handler {
            byte[][] chainBytes = NativeCrypto.encodeCertificates(chain);
            mTable.Allow(mHostAndPort, privateKey, chainBytes);

            if (privateKey instanceof OpenSSLRSAPrivateKey) {
                setSslClientCertFromCtx(((OpenSSLRSAPrivateKey)privateKey).getPkeyContext(),
                           chainBytes);
            } else if (privateKey instanceof OpenSSLDSAPrivateKey) {
                setSslClientCertFromCtx(((OpenSSLDSAPrivateKey)privateKey).getPkeyContext(),
                           chainBytes);
            if (privateKey instanceof OpenSSLKeyHolder) {
                OpenSSLKey pkey = ((OpenSSLKeyHolder) privateKey).getOpenSSLKey();
                setSslClientCertFromCtx(pkey.getPkeyContext(), chainBytes);
            } else {
                setSslClientCertFromPKCS8(privateKey.getEncoded(), chainBytes);
            }
+3 −6
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@

package android.security;

import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey;
import org.apache.harmony.xnet.provider.jsse.OpenSSLEngine;
import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey;
import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder;

import android.util.Log;

@@ -210,10 +209,8 @@ public class AndroidKeyStore extends KeyStoreSpi {
        byte[] keyBytes = null;

        final String pkeyAlias;
        if (key instanceof OpenSSLRSAPrivateKey) {
            pkeyAlias = ((OpenSSLRSAPrivateKey) key).getPkeyAlias();
        } else if (key instanceof OpenSSLDSAPrivateKey) {
            pkeyAlias = ((OpenSSLDSAPrivateKey) key).getPkeyAlias();
        if (key instanceof OpenSSLKeyHolder) {
            pkeyAlias = ((OpenSSLKeyHolder) key).getOpenSSLKey().getAlias();
        } else {
            pkeyAlias = null;
        }