Imported Upstream version 4.4.0.182

Former-commit-id: ea38b2115ac3af9a394fe6cddf2be2acd11bc002
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-06-14 09:39:34 +00:00
parent ee13743634
commit 180e8b1935
125 changed files with 1658 additions and 521 deletions

View File

@ -93,80 +93,6 @@ public class SslStreamTest {
}
}
[Test]
public void ClientCipherSuitesCallback ()
{
try {
ServicePointManager.ClientCipherSuitesCallback += (SecurityProtocolType p, IEnumerable<string> allCiphers) => {
string prefix = p == SecurityProtocolType.Tls ? "TLS_" : "SSL_";
return new List<string> { prefix + "RSA_WITH_AES_128_CBC_SHA" };
};
// client will only offers AES 128 - that's fine since the server support it (and many more ciphers)
AuthenticateClientAndServer_ClientSendsNoData ();
}
finally {
ServicePointManager.ClientCipherSuitesCallback = null;
}
}
[Test]
public void ServerCipherSuitesCallback ()
{
try {
ServicePointManager.ServerCipherSuitesCallback += (SecurityProtocolType p, IEnumerable<string> allCiphers) => {
string prefix = p == SecurityProtocolType.Tls ? "TLS_" : "SSL_";
return new List<string> { prefix + "RSA_WITH_AES_256_CBC_SHA" };
};
// server only accept AES 256 - that's fine since the client support it (and many more ciphers)
AuthenticateClientAndServer_ClientSendsNoData ();
}
finally {
ServicePointManager.ServerCipherSuitesCallback = null;
}
}
[Test]
public void CipherSuitesCallbacks ()
{
try {
ServicePointManager.ClientCipherSuitesCallback += (SecurityProtocolType p, IEnumerable<string> allCiphers) => {
string prefix = p == SecurityProtocolType.Tls ? "TLS_" : "SSL_";
return new List<string> { prefix + "RSA_WITH_AES_128_CBC_SHA", prefix + "RSA_WITH_AES_256_CBC_SHA" };
};
ServicePointManager.ServerCipherSuitesCallback += (SecurityProtocolType p, IEnumerable<string> allCiphers) => {
string prefix = p == SecurityProtocolType.Tls ? "TLS_" : "SSL_";
return new List<string> { prefix + "RSA_WITH_AES_128_CBC_SHA", prefix + "RSA_WITH_AES_256_CBC_SHA" };
};
// both client and server supports AES (128 and 256) - server will select 128 (first choice)
AuthenticateClientAndServer_ClientSendsNoData ();
}
finally {
ServicePointManager.ClientCipherSuitesCallback = null;
ServicePointManager.ServerCipherSuitesCallback = null;
}
}
[Test]
public void MismatchedCipherSuites ()
{
try {
ServicePointManager.ClientCipherSuitesCallback += (SecurityProtocolType p, IEnumerable<string> allCiphers) => {
string prefix = p == SecurityProtocolType.Tls ? "TLS_" : "SSL_";
return new List<string> { prefix + "RSA_WITH_AES_128_CBC_SHA" };
};
ServicePointManager.ServerCipherSuitesCallback += (SecurityProtocolType p, IEnumerable<string> allCiphers) => {
string prefix = p == SecurityProtocolType.Tls ? "TLS_" : "SSL_";
return new List<string> { prefix + "RSA_WITH_AES_256_CBC_SHA" };
};
// mismatch! server will refuse and send back an alert
AuthenticateClientAndServer (false, false);
}
finally {
ServicePointManager.ClientCipherSuitesCallback = null;
ServicePointManager.ServerCipherSuitesCallback = null;
}
}
private void StartClientAndAuthenticate (ClientServerState state,
IPEndPoint endPoint) {
try {