summaryrefslogtreecommitdiffstats
path: root/support
diff options
context:
space:
mode:
authorAlex Klyubin <klyubin@google.com>2014-05-29 21:10:07 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-29 21:10:07 +0000
commitd3555a45afb5c14ed037add41f94336dc0cd233b (patch)
tree572e4c58eda8ed700ccba4fa5c25b261c2ca78ed /support
parentd0cb3fb4c2e6a4ca3338cf7daea3ad02fd16a3fb (diff)
parentc0a8f479a47de31427211ea7952b3b92c0c650c2 (diff)
downloadlibcore-d3555a45afb5c14ed037add41f94336dc0cd233b.tar.gz
libcore-d3555a45afb5c14ed037add41f94336dc0cd233b.tar.bz2
libcore-d3555a45afb5c14ed037add41f94336dc0cd233b.zip
am c0a8f479: am 9adf681e: am 4352ab40: Merge "Document and assert support for TLS-PSK cipher suites."
* commit 'c0a8f479a47de31427211ea7952b3b92c0c650c2': Document and assert support for TLS-PSK cipher suites.
Diffstat (limited to 'support')
-rw-r--r--support/src/test/java/libcore/java/security/StandardNames.java8
-rw-r--r--support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java33
2 files changed, 37 insertions, 4 deletions
diff --git a/support/src/test/java/libcore/java/security/StandardNames.java b/support/src/test/java/libcore/java/security/StandardNames.java
index d4fde9447..2090d3bf0 100644
--- a/support/src/test/java/libcore/java/security/StandardNames.java
+++ b/support/src/test/java/libcore/java/security/StandardNames.java
@@ -712,6 +712,14 @@ public final class StandardNames extends Assert {
addOpenSsl("TLS_DH_anon_WITH_AES_128_GCM_SHA256");
addOpenSsl("TLS_DH_anon_WITH_AES_256_GCM_SHA384");
+ // Pre-Shared Key (PSK) cipher suites
+ addOpenSsl("TLS_PSK_WITH_RC4_128_SHA");
+ addOpenSsl("TLS_PSK_WITH_3DES_EDE_CBC_SHA");
+ addOpenSsl("TLS_PSK_WITH_AES_128_CBC_SHA");
+ addOpenSsl("TLS_PSK_WITH_AES_256_CBC_SHA");
+ addOpenSsl("TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA256");
+ addOpenSsl("TLS_ECDHE_PSK_WITH_AES_256_CBC_SHA384");
+
// RFC 5746's Signaling Cipher Suite Value to indicate a request for secure renegotiation
addBoth(CIPHER_SUITE_SECURE_RENEGOTIATION);
diff --git a/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java b/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java
index 9793d9a15..5741f2b86 100644
--- a/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java
+++ b/support/src/test/java/libcore/javax/net/ssl/TestSSLContext.java
@@ -141,15 +141,27 @@ public final class TestSSLContext extends Assert {
* TestSSLContext creation method that allows separate creation of server key store
*/
public static TestSSLContext create(TestKeyStore client, TestKeyStore server) {
+ return createWithAdditionalKeyManagers(client, server, null, null);
+ }
+
+ /**
+ * TestSSLContext creation method that allows separate creation of server key store and
+ * the use of additional {@code KeyManager} instances
+ */
+ public static TestSSLContext createWithAdditionalKeyManagers(
+ TestKeyStore client, TestKeyStore server,
+ KeyManager[] additionalClientKeyManagers, KeyManager[] additionalServerKeyManagers) {
String protocol = "TLSv1.2";
+ KeyManager[] clientKeyManagers = concat(client.keyManagers, additionalClientKeyManagers);
+ KeyManager[] serverKeyManagers = concat(server.keyManagers, additionalServerKeyManagers);
SSLContext clientContext =
- createSSLContext(protocol, client.keyManagers, client.trustManagers);
+ createSSLContext(protocol, clientKeyManagers, client.trustManagers);
SSLContext serverContext =
- createSSLContext(protocol, server.keyManagers, server.trustManagers);
+ createSSLContext(protocol, serverKeyManagers, server.trustManagers);
return create(client.keyStore, client.storePassword,
server.keyStore, server.storePassword,
- client.keyManagers,
- server.keyManagers,
+ clientKeyManagers,
+ serverKeyManagers,
client.trustManagers[0],
server.trustManagers[0],
clientContext,
@@ -296,4 +308,17 @@ public final class TestSSLContext extends Assert {
}
};
}
+
+ private static KeyManager[] concat(KeyManager[] a, KeyManager[] b) {
+ if ((a == null) || (a.length == 0)) {
+ return b;
+ }
+ if ((b == null) || (b.length == 0)) {
+ return a;
+ }
+ KeyManager[] result = new KeyManager[a.length + b.length];
+ System.arraycopy(a, 0, result, 0, a.length);
+ System.arraycopy(b, 0, result, a.length, b.length);
+ return result;
+ }
}