0001    // SSLMethod.swift
0002    //
0003    // The MIT License (MIT)
0004    //
0005    // Copyright (c) 2015 Zewo
0006    //
0007    // Permission is hereby granted, free of charge, to any person obtaining a copy
0008    // of this software and associated documentation files (the "Software"), to deal
0009    // in the Software without restriction, including without limitation the rights
0010    // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
0011    // copies of the Software, and to permit persons to whom the Software is
0012    // furnished to do so, subject to the following conditions:
0013    //
0014    // The above copyright notice and this permission notice shall be included in all
0015    // copies or substantial portions of the Software.
0016    //
0017    // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0018    // IMPLIED, INCLUDINbG BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0019    // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
0020    // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
0021    // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
0022    // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
0023    // SOFTWARE.
0024    
0025    import COpenSSL
0026    
0027    public enum SSLMethodType
Context.swift:36
	public init(method: SSLMethod = .SSLv23, type: SSLMethodType = .Unspecified) throws {
Method.swift:43
func getMethod(method: SSLMethod, type: SSLMethodType = .Unspecified) -> UnsafePointer<SSL_METHOD> {
{ 0028 case Unspecified
Context.swift:36
	public init(method: SSLMethod = .SSLv23, type: SSLMethodType = .Unspecified) throws {
Method.swift:43
func getMethod(method: SSLMethod, type: SSLMethodType = .Unspecified) -> UnsafePointer<SSL_METHOD> {
Method.swift:56
		case .Unspecified:
Method.swift:65
		case .Unspecified:
Method.swift:74
		case .Unspecified:
Method.swift:83
		case .Unspecified:
Method.swift:92
		case .Unspecified:
Method.swift:101
		case .Unspecified:
, Server
Method.swift:58
		case .Server:
Method.swift:67
		case .Server:
Method.swift:76
		case .Server:
Method.swift:85
		case .Server:
Method.swift:94
		case .Server:
Method.swift:103
		case .Server:
ServerContext.swift:29
		try super.init(method: .SSLv23, type: .Server)
, Client
ClientContext.swift:29
		try super.init(method: .SSLv23, type: .Client)
Method.swift:60
		case .Client:
Method.swift:69
		case .Client:
Method.swift:78
		case .Client:
Method.swift:87
		case .Client:
Method.swift:96
		case .Client:
Method.swift:105
		case .Client:
0029 } 0030 0031 public enum SSLMethod
Context.swift:36
	public init(method: SSLMethod = .SSLv23, type: SSLMethodType = .Unspecified) throws {
Method.swift:43
func getMethod(method: SSLMethod, type: SSLMethodType = .Unspecified) -> UnsafePointer<SSL_METHOD> {
{ 0032 // case SSLv2 // SSLv2 0033 case SSLv3
Method.swift:54
	case .SSLv3:
// SSLv3 0034 case SSLv23
ClientContext.swift:29
		try super.init(method: .SSLv23, type: .Client)
Context.swift:36
	public init(method: SSLMethod = .SSLv23, type: SSLMethodType = .Unspecified) throws {
Method.swift:63
	case .SSLv23:
ServerContext.swift:29
		try super.init(method: .SSLv23, type: .Server)
// Negotiate highest available SSL/TLS version 0035 case TLSv1
Method.swift:72
	case .TLSv1:
// TLSv1.0 0036 case TLSv1_1
Method.swift:81
	case .TLSv1_1:
// TLSv1.1 0037 case TLSv1_2
Method.swift:90
	case .TLSv1_2:
// TLSv1.2 0038 case DTLSv1
Method.swift:99
	case .DTLSv1:
// DTLSv1.0 0039 // case DTLSv1_2 // DTLSv1.2 0040 // case DTLS // DTLS 1.0 and 1.2 0041 } 0042 0043 func getMethod
Context.swift:38
        context = SSL_CTX_new(getMethod(method, type: type))
(method: SSLMethod, type: SSLMethodType = .Unspecified) -> UnsafePointer<SSL_METHOD> { 0044 switch method { 0045 /*case .SSLv2: 0046 switch type { 0047 case .Unspecified: 0048 return SSLv2_method() 0049 case .Server: 0050 return SSLv2_server_method() 0051 case .Client: 0052 return SSLv2_client_method() 0053 }*/ 0054 case .SSLv3: 0055 switch type { 0056 case .Unspecified: 0057 return SSLv3_method() 0058 case .Server: 0059 return SSLv3_server_method() 0060 case .Client: 0061 return SSLv3_client_method() 0062 } 0063 case .SSLv23: 0064 switch type { 0065 case .Unspecified: 0066 return SSLv23_method() 0067 case .Server: 0068 return SSLv23_server_method() 0069 case .Client: 0070 return SSLv23_client_method() 0071 } 0072 case .TLSv1: 0073 switch type { 0074 case .Unspecified: 0075 return TLSv1_method() 0076 case .Server: 0077 return TLSv1_server_method() 0078 case .Client: 0079 return TLSv1_client_method() 0080 } 0081 case .TLSv1_1: 0082 switch type { 0083 case .Unspecified: 0084 return TLSv1_1_method() 0085 case .Server: 0086 return TLSv1_1_server_method() 0087 case .Client: 0088 return TLSv1_1_client_method() 0089 } 0090 case .TLSv1_2: 0091 switch type { 0092 case .Unspecified: 0093 return TLSv1_2_method() 0094 case .Server: 0095 return TLSv1_2_server_method() 0096 case .Client: 0097 return TLSv1_2_client_method() 0098 } 0099 case .DTLSv1: 0100 switch type { 0101 case .Unspecified: 0102 return DTLSv1_method() 0103 case .Server: 0104 return DTLSv1_server_method() 0105 case .Client: 0106 return DTLSv1_client_method() 0107 } 0108 /*case .DTLSv1_2: 0109 switch type { 0110 case .Unspecified: 0111 return DTLSv1_2_method() 0112 case .Server: 0113 return DTLSv1_2_server_method() 0114 case .Client: 0115 return DTLSv1_2_client_method() 0116 } 0117 case .DTLS: 0118 switch type { 0119 case .Unspecified: 0120 return DTLS_method() 0121 case .Server: 0122 return DTLS_server_method() 0123 case .Client: 0124 return DTLS_client_method() 0125 }*/ 0126 } 0127 } 0128