diff options
author | Kenny Root <kroot@android.com> | 2013-04-05 21:19:01 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-04-05 21:19:01 +0000 |
commit | 96575d78a8f94b4730a0c265760e4173d7021f4a (patch) | |
tree | 387399fd7276866dd13d79851eaceb44b98b0321 /luni | |
parent | 817471f25732c46e640111b7c5ddb07a0b769d53 (diff) | |
parent | 3fb32505a22a01c95ff82435ac7f4d6da001c11c (diff) | |
download | libcore-96575d78a8f94b4730a0c265760e4173d7021f4a.zip libcore-96575d78a8f94b4730a0c265760e4173d7021f4a.tar.gz libcore-96575d78a8f94b4730a0c265760e4173d7021f4a.tar.bz2 |
Merge "Make KeyFactory.translateKey for OpenSSL keys a no-op."
Diffstat (limited to 'luni')
3 files changed, 9 insertions, 5 deletions
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLDSAKeyFactory.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLDSAKeyFactory.java index ca9f37c..efa4747 100644 --- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLDSAKeyFactory.java +++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLDSAKeyFactory.java @@ -141,8 +141,9 @@ public class OpenSSLDSAKeyFactory extends KeyFactorySpi { if (key == null) { throw new InvalidKeyException("key == null"); } - - if (key instanceof DSAPublicKey) { + if ((key instanceof OpenSSLDSAPublicKey) || (key instanceof OpenSSLDSAPrivateKey)) { + return key; + } else if (key instanceof DSAPublicKey) { DSAPublicKey dsaKey = (DSAPublicKey) key; BigInteger y = dsaKey.getY(); diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLECKeyFactory.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLECKeyFactory.java index 16d4e64..e4673a5 100644 --- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLECKeyFactory.java +++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLECKeyFactory.java @@ -133,8 +133,9 @@ public class OpenSSLECKeyFactory extends KeyFactorySpi { if (key == null) { throw new InvalidKeyException("key == null"); } - - if (key instanceof ECPublicKey) { + if ((key instanceof OpenSSLECPublicKey) || (key instanceof OpenSSLECPrivateKey)) { + return key; + } else if (key instanceof ECPublicKey) { ECPublicKey ecKey = (ECPublicKey) key; ECPoint w = ecKey.getW(); diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLRSAKeyFactory.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLRSAKeyFactory.java index c61223d..9c61abd 100644 --- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLRSAKeyFactory.java +++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLRSAKeyFactory.java @@ -165,7 +165,9 @@ public class OpenSSLRSAKeyFactory extends KeyFactorySpi { throw new InvalidKeyException("key == null"); } - if (key instanceof RSAPublicKey) { + if ((key instanceof OpenSSLRSAPublicKey) || (key instanceof OpenSSLRSAPrivateKey)) { + return key; + } else if (key instanceof RSAPublicKey) { RSAPublicKey rsaKey = (RSAPublicKey) key; try { |