@@ -25,6 +25,27 @@ extension Data {
25
25
}
26
26
27
27
enum ProxyType : String { case pac= " auto " , global= " global " , manual= " manual " } ;
28
+ enum EncryptionMethod : String {
29
+ case AES_128_GCM = " aes-128-gcm "
30
+ case AES_192_GCM = " aes-192-gcm "
31
+ case AES_256_GCM = " aes-256-gcm "
32
+ case AES_128_CFB = " aes-128-cfb "
33
+ case AES_192_CFB = " aes-192-cfb "
34
+ case AES_256_CFB = " aes-256-cfb "
35
+ case AES_128_CTR = " aes-128-ctr "
36
+ case AES_192_CTR = " aes-192-ctr "
37
+ case AES_256_CTR = " aes-256-ctr "
38
+ case CAMELLIA_128_CFB = " camellia-128-cfb "
39
+ case CAMELLIA_192_CFB = " camellia-192-cfb "
40
+ case CAMELLIA_256_CFB = " camellia-256-cfb "
41
+ case BF_CFB = " bf-cfb "
42
+ case CHACHA20_IETF_POLY1305 = " chacha20-ietf-poly1305 "
43
+ case XCHACHA20_IETF_POLY1305 = " xchacha20-ietf-poly1305 "
44
+ case SALSA20 = " salsa20 "
45
+ case CHACHA20 = " chacha20 "
46
+ case CHACHA20_IETF = " chacha20-ietf "
47
+ case RC4_MD5 = " rc4-md5 "
48
+ }
28
49
29
50
struct Globals {
30
51
static var proxyType = ProxyType . pac
@@ -79,31 +100,11 @@ class Validator {
79
100
static func method( _ str: String ) -> Bool {
80
101
// Copy from PreferencesWindowController.swift
81
102
// Better to make valid methods enumeration type.
82
- return [
83
- " aes-128-gcm " ,
84
- " aes-192-gcm " ,
85
- " aes-256-gcm " ,
86
- " aes-128-cfb " ,
87
- " aes-192-cfb " ,
88
- " aes-256-cfb " ,
89
- " aes-128-ctr " ,
90
- " aes-192-ctr " ,
91
- " aes-256-ctr " ,
92
- " camellia-128-cfb " ,
93
- " camellia-192-cfb " ,
94
- " camellia-256-cfb " ,
95
- " bf-cfb " ,
96
- " chacha20-ietf-poly1305 " ,
97
- " xchacha20-ietf-poly1305 " ,
98
- " salsa20 " ,
99
- " chacha20 " ,
100
- " chacha20-ietf " ,
101
- " rc4-md5 " ,
102
- ] . contains ( str) ;
103
+ return EncryptionMethod . init ( rawValue: str) != nil
103
104
}
104
105
105
106
static func password( _ str: String ) -> Bool {
106
- return str != " " ;
107
+ return !str . isEmpty ;
107
108
}
108
109
109
110
static func remark( _ str: String ) -> Bool {
0 commit comments