Skip to content

Commit

Permalink
Swift fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pepone committed Apr 5, 2024
1 parent 8b77123 commit dcb05b2
Showing 1 changed file with 0 additions and 98 deletions.
98 changes: 0 additions & 98 deletions swift/test/IceSSL/configuration/AllTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -688,104 +688,6 @@ public func allTests(_ helper: TestHelper, _ defaultDir: String) throws -> SSLSe
comm.destroy()
output.writeLine("ok")

output.write("testing protocols... ")
//
// In macOS we don't support IceSSL.Protocols as secure transport doesn't allow to set the enabled protocols
// instead we use IceSSL.ProtocolVersionMax IceSSL.ProtocolVersionMin to set the maximun and minimum
// enabled protocol versions. See the test bellow.
//

//
// This should fail because the client and server have no protocol
// in common.
//
properties = createClientProps(defaultProperties)
properties.setProperty(key: "IceSSL.Ciphers", value: "(DH_anon*)")
properties.setProperty(key: "IceSSL.VerifyPeer", value: "0")
properties.setProperty(key: "IceSSL.ProtocolVersionMax", value: "tls1")
properties.setProperty(key: "IceSSL.ProtocolVersionMin", value: "tls1")

comm = try helper.initialize(properties)
fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)!
d = createServerProps(defaultProperties)
d["IceSSL.Ciphers"] = "(DH_anon*)"
d["IceSSL.VerifyPeer"] = "0"
d["IceSSL.ProtocolVersionMax"] = "tls1_2"
d["IceSSL.ProtocolVersionMin"] = "tls1_2"
server = try fact.createServer(d)!
do {
try server.ice_ping()
try test(false)
} catch is ProtocolException {
// Expected on some platforms.
} catch is ConnectionLostException {
// Expected on some platforms.
}
try fact.destroyServer(server)
comm.destroy()

//
// This should succeed.
//
comm = try helper.initialize(properties)
fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)!
d = createServerProps(defaultProperties)
d["IceSSL.Ciphers"] = "(DH_anon*)"
d["IceSSL.VerifyPeer"] = "0"
d["IceSSL.ProtocolVersionMax"] = "tls1"
d["IceSSL.ProtocolVersionMin"] = "ssl3"
server = try fact.createServer(d)!
try server.ice_ping()
try fact.destroyServer(server)
comm.destroy()

//
// This should fail because the client only accept SSLv3 and the server
// use the default protocol set that disables SSLv3
//
properties = createClientProps(
defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1")
properties.setProperty(key: "IceSSL.VerifyPeer", value: "0")
properties.setProperty(key: "IceSSL.ProtocolVersionMin", value: "ssl3")
properties.setProperty(key: "IceSSL.ProtocolVersionMax", value: "ssl3")

comm = try helper.initialize(properties)

fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)!
d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1")
d["IceSSL.VerifyPeer"] = "0"
server = try fact.createServer(d)!
do {
try server.ice_ping()
try test(false)
} catch is ProtocolException {
// Expected on some platforms.
} catch is ConnectionLostException {
// Expected on some platforms.
}
try fact.destroyServer(server)
comm.destroy()

//
// This should succeed because both have SSLv3 enabled
//
properties = createClientProps(
defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1")
properties.setProperty(key: "IceSSL.VerifyPeer", value: "0")
properties.setProperty(key: "IceSSL.ProtocolVersionMin", value: "ssl3")
properties.setProperty(key: "IceSSL.ProtocolVersionMax", value: "ssl3")
comm = try helper.initialize(properties)

fact = try checkedCast(prx: comm.stringToProxy(factoryRef)!, type: SSLServerFactoryPrx.self)!
d = createServerProps(defaultProperties: defaultProperties, cert: "s_rsa_ca1", ca: "cacert1")
d["IceSSL.VerifyPeer"] = "0"
d["IceSSL.ProtocolVersionMin"] = "ssl3"
server = try fact.createServer(d)!
try server.ice_ping()
try fact.destroyServer(server)
comm.destroy()
output.writeLine("ok")

output.write("testing expired certificates... ")
properties = createClientProps(
defaultProperties: defaultProperties, cert: "c_rsa_ca1", ca: "cacert1")
Expand Down

0 comments on commit dcb05b2

Please sign in to comment.