-
Notifications
You must be signed in to change notification settings - Fork 25
/
helper.go
46 lines (38 loc) · 1.03 KB
/
helper.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package pkcs1
// Cipher 列表
var PEMCiphers = map[string]Cipher{
"DESCBC": CipherDESCBC,
"DESEDE3CBC": Cipher3DESCBC,
"AES128CBC": CipherAES128CBC,
"AES192CBC": CipherAES192CBC,
"AES256CBC": CipherAES256CBC,
"DESCFB": CipherDESCFB,
"DESEDE3CFB": Cipher3DESCFB,
"AES128CFB": CipherAES128CFB,
"AES192CFB": CipherAES192CFB,
"AES256CFB": CipherAES256CFB,
"DESOFB": CipherDESOFB,
"DESEDE3OFB": Cipher3DESOFB,
"AES128OFB": CipherAES128OFB,
"AES192OFB": CipherAES192OFB,
"AES256OFB": CipherAES256OFB,
"DESCTR": CipherDESCTR,
"DESEDE3CTR": Cipher3DESCTR,
"AES128CTR": CipherAES128CTR,
"AES192CTR": CipherAES192CTR,
"AES256CTR": CipherAES256CTR,
}
// 获取 Cipher 类型
func GetPEMCipher(name string) Cipher {
if cipher, ok := PEMCiphers[name]; ok {
return cipher
}
return nil
}
// 检测 Cipher 类型
func CheckPEMCipher(name string) bool {
if _, ok := PEMCiphers[name]; ok {
return true
}
return false
}