am 46cdd437: am 0048f466: Merge "Switch TLS Channel ID API from ECPrivateKey to PrivateKey."
* commit '46cdd4376775c3b84139f2e4d734ef8affbd605c':
Switch TLS Channel ID API from ECPrivateKey to PrivateKey.
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/NativeCrypto.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/NativeCrypto.java
index 770e2a3..e1038a6 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/NativeCrypto.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/NativeCrypto.java
@@ -23,12 +23,12 @@
import java.nio.ByteOrder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
import java.security.SignatureException;
import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-import java.security.interfaces.ECPrivateKey;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
@@ -764,7 +764,7 @@
public static native void SSL_use_PKCS8_PrivateKey_for_tls_channel_id(
long ssl, byte[] pkcs8EncodedPrivateKey) throws SSLException;
- public static void SSL_set1_tls_channel_id(long ssl, ECPrivateKey privateKey)
+ public static void SSL_set1_tls_channel_id(long ssl, PrivateKey privateKey)
throws SSLException {
if (privateKey == null) {
throw new NullPointerException("privateKey == null");
diff --git a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
index 777c5b3..21f6127 100644
--- a/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
+++ b/luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java
@@ -30,7 +30,6 @@
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-import java.security.interfaces.ECPrivateKey;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -79,7 +78,7 @@
/** Whether the TLS Channel ID extension is enabled. This field is server-side only. */
private boolean channelIdEnabled;
/** Private key for the TLS Channel ID extension. This field is client-side only. */
- private ECPrivateKey channelIdPrivateKey;
+ private PrivateKey channelIdPrivateKey;
private OpenSSLSessionImpl sslSession;
private final Socket socket;
private boolean autoClose;
@@ -858,13 +857,13 @@
* <p>This method needs to be invoked before the handshake starts.
*
* @param privateKey private key (enables TLS Channel ID) or {@code null} for no key (disables
- * TLS Channel ID). The private key is an Elliptic Curve (EC) key based on the NIST
+ * TLS Channel ID). The private key must be an Elliptic Curve (EC) key based on the NIST
* P-256 curve (aka SECG secp256r1 or ANSI X9.62 prime256v1).
*
* @throws IllegalStateException if this is a server socket or if the handshake has already
* started.
*/
- public void setChannelIdPrivateKey(ECPrivateKey privateKey) {
+ public void setChannelIdPrivateKey(PrivateKey privateKey) {
if (!getUseClientMode()) {
throw new IllegalStateException("Server mode");
}
diff --git a/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java b/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java
index fba683b..f456f3e 100644
--- a/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java
+++ b/luni/src/test/java/org/apache/harmony/xnet/provider/jsse/NativeCryptoTest.java
@@ -29,10 +29,10 @@
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.KeyStore.PrivateKeyEntry;
+import java.security.PrivateKey;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.security.interfaces.DSAPublicKey;
-import java.security.interfaces.ECPrivateKey;
import java.security.interfaces.ECPublicKey;
import java.security.interfaces.RSAPrivateCrtKey;
import java.security.interfaces.RSAPublicKey;
@@ -72,7 +72,7 @@
private static byte[] CLIENT_PRIVATE_KEY;
private static byte[][] CLIENT_CERTIFICATES;
private static byte[][] CA_PRINCIPALS;
- private static ECPrivateKey CHANNEL_ID_PRIVATE_KEY;
+ private static PrivateKey CHANNEL_ID_PRIVATE_KEY;
private static byte[] CHANNEL_ID;
@Override
@@ -613,7 +613,7 @@
private static final boolean DEBUG = false;
public static class Hooks {
- private ECPrivateKey channelIdPrivateKey;
+ private PrivateKey channelIdPrivateKey;
public long getContext() throws SSLException {
return NativeCrypto.SSL_CTX_new();