am ebb61ca2: Merge "Track libcore changes for OpenSSLKey"

# Via Gerrit Code Review (1) and Kenny Root (1)
* commit 'ebb61ca2ed20472d684ab1490b61482392121051':
  Track libcore changes for OpenSSLKey
This commit is contained in:
Kenny Root
2013-01-25 16:39:33 -08:00
committed by Android Git Automerger
3 changed files with 14 additions and 23 deletions

View File

@ -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,

View File

@ -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,14 +56,11 @@ 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);
setSslClientCertFromPKCS8(privateKey.getEncoded(), chainBytes);
}
} catch (CertificateEncodingException e) {
post(new Runnable() {

View File

@ -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;
}