Merge "Track libcore changes for OpenSSLKey"
This commit is contained in:
@ -56,8 +56,8 @@ import java.util.Map;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.harmony.security.provider.cert.X509CertImpl;
|
import org.apache.harmony.security.provider.cert.X509CertImpl;
|
||||||
import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey;
|
import org.apache.harmony.xnet.provider.jsse.OpenSSLKey;
|
||||||
import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey;
|
import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder;
|
||||||
|
|
||||||
class BrowserFrame extends Handler {
|
class BrowserFrame extends Handler {
|
||||||
|
|
||||||
@ -1129,13 +1129,10 @@ class BrowserFrame extends Handler {
|
|||||||
if (table.IsAllowed(hostAndPort)) {
|
if (table.IsAllowed(hostAndPort)) {
|
||||||
// previously allowed
|
// previously allowed
|
||||||
PrivateKey pkey = table.PrivateKey(hostAndPort);
|
PrivateKey pkey = table.PrivateKey(hostAndPort);
|
||||||
if (pkey instanceof OpenSSLRSAPrivateKey) {
|
if (pkey instanceof OpenSSLKeyHolder) {
|
||||||
|
OpenSSLKey sslKey = ((OpenSSLKeyHolder) pkey).getOpenSSLKey();
|
||||||
nativeSslClientCert(handle,
|
nativeSslClientCert(handle,
|
||||||
((OpenSSLRSAPrivateKey)pkey).getPkeyContext(),
|
sslKey.getPkeyContext(),
|
||||||
table.CertificateChain(hostAndPort));
|
|
||||||
} else if (pkey instanceof OpenSSLDSAPrivateKey) {
|
|
||||||
nativeSslClientCert(handle,
|
|
||||||
((OpenSSLDSAPrivateKey)pkey).getPkeyContext(),
|
|
||||||
table.CertificateChain(hostAndPort));
|
table.CertificateChain(hostAndPort));
|
||||||
} else {
|
} else {
|
||||||
nativeSslClientCert(handle,
|
nativeSslClientCert(handle,
|
||||||
|
@ -21,8 +21,8 @@ import java.security.PrivateKey;
|
|||||||
import java.security.cert.CertificateEncodingException;
|
import java.security.cert.CertificateEncodingException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import org.apache.harmony.xnet.provider.jsse.NativeCrypto;
|
import org.apache.harmony.xnet.provider.jsse.NativeCrypto;
|
||||||
import org.apache.harmony.xnet.provider.jsse.OpenSSLDSAPrivateKey;
|
import org.apache.harmony.xnet.provider.jsse.OpenSSLKey;
|
||||||
import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey;
|
import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClientCertRequestHandler: class responsible for handling client
|
* ClientCertRequestHandler: class responsible for handling client
|
||||||
@ -56,14 +56,11 @@ public final class ClientCertRequestHandler extends Handler {
|
|||||||
byte[][] chainBytes = NativeCrypto.encodeCertificates(chain);
|
byte[][] chainBytes = NativeCrypto.encodeCertificates(chain);
|
||||||
mTable.Allow(mHostAndPort, privateKey, chainBytes);
|
mTable.Allow(mHostAndPort, privateKey, chainBytes);
|
||||||
|
|
||||||
if (privateKey instanceof OpenSSLRSAPrivateKey) {
|
if (privateKey instanceof OpenSSLKeyHolder) {
|
||||||
setSslClientCertFromCtx(((OpenSSLRSAPrivateKey)privateKey).getPkeyContext(),
|
OpenSSLKey pkey = ((OpenSSLKeyHolder) privateKey).getOpenSSLKey();
|
||||||
chainBytes);
|
setSslClientCertFromCtx(pkey.getPkeyContext(), chainBytes);
|
||||||
} else if (privateKey instanceof OpenSSLDSAPrivateKey) {
|
|
||||||
setSslClientCertFromCtx(((OpenSSLDSAPrivateKey)privateKey).getPkeyContext(),
|
|
||||||
chainBytes);
|
|
||||||
} else {
|
} else {
|
||||||
setSslClientCertFromPKCS8(privateKey.getEncoded(),chainBytes);
|
setSslClientCertFromPKCS8(privateKey.getEncoded(), chainBytes);
|
||||||
}
|
}
|
||||||
} catch (CertificateEncodingException e) {
|
} catch (CertificateEncodingException e) {
|
||||||
post(new Runnable() {
|
post(new Runnable() {
|
||||||
|
@ -16,9 +16,8 @@
|
|||||||
|
|
||||||
package android.security;
|
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.OpenSSLEngine;
|
||||||
import org.apache.harmony.xnet.provider.jsse.OpenSSLRSAPrivateKey;
|
import org.apache.harmony.xnet.provider.jsse.OpenSSLKeyHolder;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@ -210,10 +209,8 @@ public class AndroidKeyStore extends KeyStoreSpi {
|
|||||||
byte[] keyBytes = null;
|
byte[] keyBytes = null;
|
||||||
|
|
||||||
final String pkeyAlias;
|
final String pkeyAlias;
|
||||||
if (key instanceof OpenSSLRSAPrivateKey) {
|
if (key instanceof OpenSSLKeyHolder) {
|
||||||
pkeyAlias = ((OpenSSLRSAPrivateKey) key).getPkeyAlias();
|
pkeyAlias = ((OpenSSLKeyHolder) key).getOpenSSLKey().getAlias();
|
||||||
} else if (key instanceof OpenSSLDSAPrivateKey) {
|
|
||||||
pkeyAlias = ((OpenSSLDSAPrivateKey) key).getPkeyAlias();
|
|
||||||
} else {
|
} else {
|
||||||
pkeyAlias = null;
|
pkeyAlias = null;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user